App

This interface provides core methods associated with the application. It also exposes events for low-memory conditions and activity state changes.

Types

// Indicates whether the app is active or inactive
enum AppActivationState {
    // App is running and in foreground
    Active = 1,

    // App is running and in background
    Background = 2,

    // App is inactive
    // On RN mobile platforms, it is an intermediate state between when app transitions between foreground and background.
    // On desktop platforms, this is currently not being used.
    Inactive = 3,

    // iOS specific activation state for extensions implemented
    // with react-native
    Extension = 4
}

Methods

// Initializes the app. This should be one of the first calls made.
// Specifies whether app is running in "debug" mode, typically with
// asserts and unminified code. Also specifies whether in "development"
// mode, which can indicate that additional logging or fewer security
// checks are appropriate.
initialize(debug: boolean, development: boolean): void;

// Returns the current activitation state for the app
getActivationState(): AppActivationState;

Events

// Triggered when the activation state changes
activationStateChangedEvent: SubscribableEvent<
    (state: AppActivationState) => void>;

// Triggered when a low-memory warning occurs
memoryWarningEvent: SubscribableEvent<() => void>;