Hello everybody,
i'm developing a software for Android 2.2 Froyo, what my sofware has
to do is pritty simple:
it has to check the presence of a particular WiFi network (let's say
"Mywifi") and if the power level of that network is good enough it has
to redirect all the internet data traffic through the WiFi interface.
Otherwise all the data traffic as to flow through the mobile
(cellular) data connection.

The problem is that the "Mywifi" network need the user to login before
the user can surf using the WiFi network. The login is made at
application level, i.e. the WiFi interface has to be associated with
the access point with a regular IP address before the user (in my case
the login is made automatically by my software) can login.
As the WiFi interface is associated, the Android system redirect the
whole internet traffic over the WiFi interface, but as the user is not
logged in yet, all the connections fall. Of course after few seconds
(sometimes more then few) the login procedure has terminated and the
user can surf again using the WiFi connection.
What i'd like to do is to avoid the user to be offline for the
duration of the login procedure (technically i'm trying to implement a
meake-before-break handover), this is necessary since the login
procedure, due to problem at the server-side, doesn't succeed
everytime, or simetimes it takes several seconds.

I tried some Android API: setNetworkPreference, requestRouteToHost,
startUsingNetworkPreference, but they don't seem to work.
Here is my approach to the 3G -> WiFi handover:

 connectivityManager.setNetworkPreference(TYPE_MOBILE)
    //  handover to WiFi triggered
 wifiManager.enableNetwork(mywifiId, true)
 wifiManager.reconnect()
 connectivityManager.requestRouteToHost(TYPE_WIFI, loginServerAddr)
    // execute login
    // login procedure succeed
 connectivityManager.setNetworkPreference(TYPE_WIFI)

Unfortunately this approach doesn't work since, as the WiFi network is
associated, all the data traffic will try to goes through the WiFi
interface.

Does anybody know how to make work this approach? Or at least does
anybody have suggestions about make-before-break handover on Android?
I have to develop the application for a commercial purpose, that means
i cannot hack the system to change low-level features of Android, i
have to develop the app with normal application rights, or if not
possible, with system application rights.

In addition I'd like to know at which level Android selects a network
rather than another one, either at IP level adding a rule in the
routing table, or somehow at lower level, and furthermore, how does
the setNetworkPreference method work? Does this method change the
Android native preference for WiFi network?


Thanks for reading and for your answers in advance.

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

Reply via email to