>From MountService?  Does that sound like a networking device?

Your 3g modem should have a DataStateTracker class associated with it
(MobileDataStateTracker?) instantiated by ConnectivityService.  It reports
to ConnectivityService when it's connected or disconnected and is told to
teardown or reconnect depending on priorities and what the other options
are doing.  ConnectivityService will also send out broadcasts to let the
statusbar know what to display.  MountService should not be involved.

R

On Tue, May 8, 2012 at 4:26 AM, Vikas KM <[email protected]> wrote:

> Hi Robert,
>
> I am trying to run this from MountService.java...
> I am running 3G Modem to get the internet connection.
>
> I want to show the 3g icon in status bar with the connectivity is
> available for other apps...
>
>
>
> --------------
> Regards
>
> Vikas KM
>
>
>
> On Fri, May 4, 2012 at 9:26 PM, Robert Greenwalt <[email protected]>wrote:
>
>>
>>
>> On Fri, May 4, 2012 at 4:15 AM, Vikas KM <[email protected]> wrote:
>>
>>> HI Robert...
>>>
>>> Below is the code....
>>>
>>> **************************************
>>>
>>>             ConnectivityManager CM;
>>>             CM = (ConnectivityManager)mContext.getSystemService(Context.
>>> CONNECTIVITY_SERVICE);
>>>             CM.reportInetCondition(CM.TYPE_MOBILE, 100);
>>>
>>>  The reportInetCondition is to be used by applications to report their
>> findings back to CM.  This is not for networks to indicate they are
>> available.  You didn't indicate who is running this code.
>>
>>
>>
>>>             NetworkInfo ni;
>>>              //CM.setNetworkPreference(0);
>>>             //CM.setMobileDataEnabled(true);
>>>             //CM.setRadio(0, true);
>>>
>>>             SystemClock.sleep(3000);
>>>
>>>             Intent broadcastIntent = new Intent();
>>>             broadcastIntent.setAction("ConnectivityManager.
>>> CONNECTIVITY_ACTION");
>>>             if(broadcastIntent != null)
>>>                 mContext.sendBroadcast(broadcastIntent);
>>
>>
>> Again, you haven't said who is running this code, but only the CM should
>> send this broadcast - this is an output from CM, not an input.
>>
>>
>>>
>>>
>>>             ni = CM.getActiveNetworkInfo();
>>>             if (ni != null && ni.isConnectedOrConnecting())
>>>                 Slog.e(TAG, "Network Connected
>>> .........................");
>>>             else
>>>                 Slog.e(TAG, "Network Not Connected
>>> .......................");
>>>
>>>
>>> ***************************************
>>>
>>>
>>> Is the above code right way of doing?
>>>
>> No, I gave some info above, but this is not the right way to do things.
>>
>>
>>> I want apps to know that there is network.
>>>
>> You getActiveNetworkInfo code is good - that should tell you on a working
>> device if there is a network or not.
>>
>>
>>>
>>> I am able to connect to internet through browser but the network icons
>>> are not up...
>>>
>> Are you making this device or is this a commercial device?  If you are
>> porting to new hardware you need to make sure your MobileDataStateTracker
>> is working - it is the object that feeds mobile data state info into the
>> connectivity service.  It should indicate when it is connected and that
>> will cause the connectivity service to send out broadcast
>> (CONNECTIVITY_ACTION) indicating it's connected.
>>
>> R
>>
>
>

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to