Voidcode Voidcode - 1 year ago 69
Android Question

ConnectivityManager do not work on Motorola xoom (honeycomb 3.2)

I have a method call


to check if the user have enable wap/wifi/wimax this works for Android 2.1 to 2.3+.

But now a user of the app which uses honeycomb 3.2 on a Motorola xoom
rapport to me that he canĀ“t open the app.

In my android developer web-interface I can see this log-error: http://paste.ubuntu.com/811881/

private boolean isNetworkAvailable()
ConnectivityManager connec = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mobileInfo = connec.getNetworkInfo(0);
NetworkInfo wifiInfo = connec.getNetworkInfo(1);
NetworkInfo wimaxInfo = connec.getNetworkInfo(6);
if (wimaxInfo!=null) {
return mobileInfo.isConnected() || wifiInfo.isConnected()|| wimaxInfo.isConnected();
else {
return mobileInfo.isConnected() || wifiInfo.isConnected();

See the whole Class/Activity here(line 276):


Answer Source

mobileInfo or wifiInfo could be null. On a wifi-only device I wouldn't be surprised if mobileInfo (ConnectivityManager.TYPE_MOBILE) is null.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download