A blog containing tips and trips of the mobile developing trade.
2010/06/24
Detecting network availability on Android
This tip is not really a ‘hidden feature’, but it’s useful and can come in handy if you don’t want to register BroadcastReceiver and add listeners for network events, but just want to check if you have network access at a certain point.
it should never return null, so this is just a workaround, in case for some reason we didn't get the manager, i'd rather try the network than silently fail...
If getSystemService failed to return valid ConnectivityManager and returned null, then return true?
ReplyDeleteit should never return null, so this is just a workaround, in case for some reason we didn't get the manager, i'd rather try the network than silently fail...
ReplyDelete