My application has some code which detects if the Andoid is currently
connected on the mobile or wi-fi network. On Android 1.5 this code
correctly detected the wi-fi connectivity when the Andoid was showing
the wi-fi connection icon in the bar at the top of the screen. But
after upgrading to Android 1.6 the code always says the active network
is the mobile network, even when the icon in the bar at the top of the
screen is showing it is connected to a wi-fi network.
The code I am using is:
private static void updateWiFiConnectionState(Context context) {
try {
ConnectivityManager connectivityManager = (ConnectivityManager)
context.getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo networkInfo =
connectivityManager.getActiveNetworkInfo();
boolean hasActiveWiFiConnection = false;
if ((networkInfo != null) && networkInfo.isConnected() &&
(networkInfo.getType() ==
ConnectivityManager.TYPE_WIFI)) {
hasActiveWiFiConnection = true;
}
Log.d(TAG, "Wi-Fi connected state set to " +
hasActiveWiFiConnection);
setWiFiConnectionState(context, hasActiveWiFiConnection);
} catch (Exception e) {
Log.e(TAG, "Exception " + e.getMessage() + " while getting Wi-
Fi state");
setWiFiConnectionState(context, false);
}
}
What I am wondering is with Android 1.6 is it actually using the
bandwidth on the mobile network instead of the wi-fi network when both
networks are present? This seems like both a waste of phone data
bandwidth, and a performance problem with it selecting the slower
speed phone data network over the faster wi-fi network, if Android 1.6
is really doing this.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---