01
private
boolean
isDataConnectionAvailable
(){
02 ConnectivityManager connMgr = ( ConnectivityManager) getSystemService( CONNECTIVITY_SERVICE);
03 if( connMgr == null ){
04 return false;
05 }
06 NetworkInfo netInfo = connMgr . getActiveNetworkInfo();
07 if( netInfo == null || ! netInfo . isAvailable ()){
08 return false;
09 }
10 return true;
11 }
02 ConnectivityManager connMgr = ( ConnectivityManager) getSystemService( CONNECTIVITY_SERVICE);
03 if( connMgr == null ){
04 return false;
05 }
06 NetworkInfo netInfo = connMgr . getActiveNetworkInfo();
07 if( netInfo == null || ! netInfo . isAvailable ()){
08 return false;
09 }
10 return true;
11 }