public class AppStateModule extends NativeAppStateSpec implements LifecycleEventListener, WindowFocusChangeListener
NativeModule.NativeMethod
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APP_STATE_ACTIVE |
static java.lang.String |
APP_STATE_BACKGROUND |
static java.lang.String |
NAME |
static java.lang.String |
TAG |
METHOD_TYPE_ASYNC, METHOD_TYPE_PROMISE, METHOD_TYPE_SYNC
Constructor and Description |
---|
AppStateModule(ReactApplicationContext reactContext) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(java.lang.String eventName) |
void |
getCurrentAppState(Callback success,
Callback error) |
java.lang.String |
getName() |
java.util.Map<java.lang.String,java.lang.Object> |
getTypedExportedConstants() |
void |
onHostDestroy()
Called when host activity receives destroy event (e.g.
|
void |
onHostPause()
Called when host activity receives pause event (e.g.
|
void |
onHostResume()
Called either when the host activity receives a resume event (e.g.
|
void |
onWindowFocusChange(boolean hasFocus) |
void |
removeListeners(double count) |
getConstants
getCurrentActivity, getReactApplicationContext, getReactApplicationContextIfActiveOrWarn
canOverrideExistingModule, hasConstants, initialize, invalidate, onCatalystInstanceDestroy
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
invalidate
public static final java.lang.String TAG
public static final java.lang.String NAME
public static final java.lang.String APP_STATE_ACTIVE
public static final java.lang.String APP_STATE_BACKGROUND
public AppStateModule(ReactApplicationContext reactContext)
public java.lang.String getName()
getName
in interface NativeModule
require()
this module
from javascript.public java.util.Map<java.lang.String,java.lang.Object> getTypedExportedConstants()
getTypedExportedConstants
in class NativeAppStateSpec
public void getCurrentAppState(Callback success, Callback error)
getCurrentAppState
in class NativeAppStateSpec
public void onHostResume()
LifecycleEventListener
Activity#onResume
or
if the native module that implements this is initialized while the host activity is already
resumed. Always called for the most current activity.onHostResume
in interface LifecycleEventListener
public void onHostPause()
LifecycleEventListener
Activity#onPause
. Always called
for the most current activity.onHostPause
in interface LifecycleEventListener
public void onHostDestroy()
LifecycleEventListener
Activity#onDestroy
. Only called
for the last React activity to be destroyed.onHostDestroy
in interface LifecycleEventListener
public void onWindowFocusChange(boolean hasFocus)
onWindowFocusChange
in interface WindowFocusChangeListener
public void addListener(java.lang.String eventName)
addListener
in class NativeAppStateSpec
public void removeListeners(double count)
removeListeners
in class NativeAppStateSpec