@ RequiresPermission ( Manifest . permission . ACCESS_NETWORK_STATE ) public static Observable < Connectivity > observeNetworkConnectivity ( final Context context ) { final NetworkObservingStrategy strategy ; if ( Preconditions . isAtLeastAndroidMarshmallow ( ) ) { strategy = new MarshmallowNetworkObservingStrategy ( ) ; } else if ( Preconditions . isAtLeastAndroidLollipop ( ) ) { strategy = new LollipopNetworkObservingStrategy ( ) ; } else { strategy = new PreLollipopNetworkObservingStrategy ( ) ; } return observeNetworkConnectivity ( context , strategy ) ; }
Observes network connectivity . Information about network state type and typeName are contained in observed Connectivity object .