Code example for NetworkInfo

Methods: isAvailable

0
	 
	public static boolean isWifiConnected( Context context ){
		ConnectivityManager manager = ( ConnectivityManager )context.getSystemService( Context.CONNECTIVITY_SERVICE );
		NetworkInfo		    info	= manager.getNetworkInfo( ConnectivityManager.TYPE_WIFI );
		 
		return info != null && info.isConnected() && info.isAvailable();
	} 
	 
	public static boolean isConnectivityAvailable( Context context ) {
		ConnectivityManager manager = ( ConnectivityManager )context.getSystemService( Context.CONNECTIVITY_SERVICE );
		NetworkInfo		    info	= manager.getActiveNetworkInfo();
		 
		return info != null && info.isConnected();
	} 
	 
	public boolean isConnected(){ 
		return mConnectivityManager.getNetworkInfo( ConnectivityManager.TYPE_WIFI ).isConnected();
	} 
	 
	public String getSSID( ) {
		return mWifiInfo.getSSID();