Code example for NetworkInfo

Methods: getTypeNameisConnected

0
 
	@Override 
	public void onReceive(Context context, Intent intent) {
		ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo ni = cm.getActiveNetworkInfo();
		if (ni != null && ni.isConnected()) {
			list.isConnected = true;
			list.setTitle("Download Accelerator - Connected to " + ni.getTypeName());
		} else { 
			list.isConnected = false;
			list.setTitle("Download Accelerator - Disconnected");
		} 
	} 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE