The phone will switch back and forth all day long if necessary.
The code that handles the switching is hidden from the application
namespace, so you'd probably need to download the Android source from
AOSP and nose through it yourself... it may even be in the C/C++
source.

If you just want to know that the switch is occurring you can set up a
receiver to listen for "android.net.conn.CONNECTIVITY_CHANGE"
broadcasts
When you get one of these there are various params that will vary
depending on carrier and setup of the phone... I have generally found
that the broadcast will have an "extra" called
"noConnectivity" (static is ConnectivityManager.NO_CONNECTIVITY) set
to true if the phone has no connectivity at all.

Other than that I've found that if I grab an instance of
ConnectivityManager and call "getActiveNetworkInfo()" I'll get NULL if
there is no connectivity or a "NetworkInfo" object if there is.

(I have to use this second method at app startup as the broadcast is
not one of those that gets Cached by the OS)

Take a look at the android.net.ConnectivityManager documentation -
there may be useful info in there for you.

Doug


On Feb 3, 1:35 am, subho <[email protected]> wrote:
> Hi Doug,
> I've a query on your findings.
>
> After step 4,if WiFi again gets disconnected,does the phone again
> switches back to gprs/cellular ?
>
> Do you have any idea,which piece of code in Android Framework handles
> these type of switchings ?
>
> Your inputs will be of great help for me.
>
> Thanks,
> Subho
>
> On Feb 2, 3:48 am, Doug <[email protected]> wrote:
>
>
>
> > I haven't confirmed on the absolute latest version, but in my
> > experience the answer is Yes.
> > This isn't without its problems though - I have found that if 
> > theswitchoccurs when you have (say) just sent an http request via the
> > cellular network your connection will either drop or timeout and
> > you'll need to initiate it again over the new bearer.
>
> > i.e.
> > * Connected via 3G
> > * Send HTTP GET to web site
> > * Phone switches toWiFi
> > * 3G connection dropped
>
> > That's my experience anyway :)
>
> > Doug
>
> > On Feb 1, 2:24 am, subho <[email protected]> wrote:
>
> > > Does android framework support automaticswitchto Wi-Fi when
> > > detected, from cellular network ?
> > > Please post your views.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to