> Check the network availability in Android | krehstorrs
NEW POST | Welcome to Krehstorrs Blog
Home » » Check the network availability in Android

Check the network availability in Android

Check the network availability in Android
Obviously the network on an Android device is not always available. You can check the network is currently available via the following code
Check the network availability in Android
Check the network availability in Android

 public boolean isNetworkAvailable() {  
   ConnectivityManager cm = (ConnectivityManager)   
    getSystemService(Context.CONNECTIVITY_SERVICE);  
   NetworkInfo networkInfo = cm.getActiveNetworkInfo();  
   // if no network is available networkInfo will be null  
   // otherwise check if we are connected  
   if (networkInfo != null && networkInfo.isConnected()) {  
     return true;  
   }  
   return false;  
 }   
You have just read an article that category Android by title Check the network availability in Android. You can bookmark this page with the URL http://krehstorrs.blogspot.com/2013/03/check-network-availability-in-android.html Thank you!
Share this article :

0 comments:

Post a Comment

 
Support : Home | Sitemap | Privacy | Link List
Copyright © 2013. krehstorrs - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger