constructor() {
    super(RCTAppState);

    this.isAvailable = true;
    this._eventHandlers = {
      change: new Map(),
      memoryWarning: new Map(),
    };

    // TODO: Remove the 'active' fallback after `initialAppState` is exported by
    // the Android implementation.
    this.currentState = RCTAppState.initialAppState || 'active';

    let eventUpdated = false;

    // TODO: this is a terrible solution - in order to ensure `currentState`
    // prop is up to date, we have to register an observer that updates it 
    // whenever the state changes, even if nobody cares. We should just 
    // deprecate the `currentState` property and get rid of this.
    this.addListener(
      'appStateDidChange',
      (appStateData) => {
        eventUpdated = true;
        this.currentState = appStateData.app_state;
      }
    );

    // TODO: see above - this request just populates the value of `currentState`
    // when the module is first initialized. Would be better to get rid of the
    // prop and expose `getCurrentAppState` method directly.
    RCTAppState.getCurrentAppState(
      (appStateData) => {
        if (!eventUpdated) {
          this.currentState = appStateData.app_state;
        }
      },
      logError
    );
  }
`AppState` can tell you if the app is in the foreground or background,
and notify you when the state changes.

See http://facebook.github.io/react-native/docs/appstate.html