Tuesday, August 16, 2011

[android-developers] Bug in connectivityManager?

Does anyone know why when you advance your phone's date, say three
months, into the future that the
connectivityManager.getActiveNetworkInfo() returns null?

I have code in my application like this

NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();

After setting the date into the future, networkInfo is ALWAYS null.

Looking at the Android source I see this:

public NetworkInfo getActiveNetworkInfo() {
try {
return mService.getActiveNetworkInfo();
} catch (RemoteException e) {
return null;
}
}

I guess this isn't a big issue, but as you cannot guarantee that the
user has their phone set to automatic date/time update, you can see
where it could be a problem.

Anyone else see this or know why it occurs? To reproduce it just
execute the above code after you set your phone's date up three
months.

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment