@Test @Config(sdk = 21) public void shouldBeAtLeastAndroidLollipop() { boolean isAtLeastAndroidLollipop = Preconditions.isAtLeastAndroidLollipop(); assertThat(isAtLeastAndroidLollipop).isTrue(); }
@Test @Config(sdk = 22) public void shouldBeAtLeastAndroidLollipopForHigherApi() { boolean isAtLeastAndroidLollipop = Preconditions.isAtLeastAndroidLollipop(); assertThat(isAtLeastAndroidLollipop).isTrue(); }
/** * Observes network connectivity. Information about network state, type and typeName are contained * in * observed Connectivity object. * * @param context Context of the activity or an application * @return RxJava Observable with Connectivity class containing information about network state, * type and typeName */ @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); }