Use network intents to perform tasks while data is allowed

suggest change

When your device connects to a network, an intent is sent. Many apps don’t check for these intents, but to make your application work properly, you can listen to network change intents that will tell you when communication is possible. To check for network connectivity you can, for example, use the following clause:

if (intent.getAction().equals(android.net.ConnectivityManager.CONNECTIVITY_ACTION)){ NetworkInfo info = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); //perform your action when connected to a network }

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents