public class ReactiveAirplaneMode
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
INTENT_EXTRA_STATE |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkContextIsNotNull(android.content.Context context)
Validation method, which checks if context of the Activity or Application is not null
|
static ReactiveAirplaneMode |
create()
Creates an instance of ReactiveAirplaneMode class
|
protected android.content.BroadcastReceiver |
createBroadcastReceiver(<any> emitter)
Creates BroadcastReceiver for monitoring airplane mode
|
protected android.content.IntentFilter |
createIntentFilter()
Creates IntentFilter for BroadcastReceiver
|
<any> |
get(android.content.Context context)
Gets airplane mode state wrapped within a Single type
|
<any> |
getAndObserve(android.content.Context context)
Emits current state of the Airplane Mode in the beginning of the subscription
and then Observes Airplane Mode state of the device with BroadcastReceiver.
|
boolean |
isAirplaneModeOn(android.content.Context context)
Checks airplane mode once basing on the system settings.
|
<any> |
observe(android.content.Context context)
Observes Airplane Mode state of the device with BroadcastReceiver.
|
protected void |
onError(java.lang.String message,
java.lang.Exception exception)
Handles errors which occurs within this class
|
protected void |
tryToUnregisterReceiver(android.content.BroadcastReceiver receiver,
android.content.Context context)
Tries to unregister BroadcastReceiver.
|
protected static final java.lang.String INTENT_EXTRA_STATE
public static ReactiveAirplaneMode create()
public <any> getAndObserve(android.content.Context context)
context - of the Application or Activitypublic <any> observe(android.content.Context context)
context - of the Application or Activityprotected android.content.IntentFilter createIntentFilter()
protected android.content.BroadcastReceiver createBroadcastReceiver(<any> emitter)
emitter - for RxJavaprotected void tryToUnregisterReceiver(android.content.BroadcastReceiver receiver,
android.content.Context context)
onError(java.lang.String, java.lang.Exception) method
if receiver was already unregisteredreceiver - BroadcastReceivercontext - of the Application or Activityprotected void onError(java.lang.String message,
java.lang.Exception exception)
message - with an errorexception - which occurredpublic <any> get(android.content.Context context)
context - of the Application or Activitypublic boolean isAirplaneModeOn(android.content.Context context)
context - of the Activity or Applicationprotected void checkContextIsNotNull(android.content.Context context)
context - of the Activity or application