August 2016
Intermediate to advanced
412 pages
9h 3m
English
Developers barely check the network status in the real world. Many of the alarms, broadcasts, and repetitive tasks we perform have to deal with an Internet connection. But if there is no active Internet connection, what is the purpose of performing all those operations? It would be more efficient to ignore all those operations until the Internet connection is back on track and working.
Determining the current Internet connection can be easily done with the following code snippet:
ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService (Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo(); boolean isConnected = activeNetwork != null ...
Read now
Unlock full access