diff --git a/bgMessaging.js b/bgMessaging.js index c5911ac..60b98b2 100644 --- a/bgMessaging.js +++ b/bgMessaging.js @@ -1,17 +1,17 @@ //@flow import { NativeModules, AppState } from 'react-native'; import Logger from './Logger'; const { SylkNative } = NativeModules; const logger = new Logger('bgMessaging'); export default async (remoteMessage) => { logger.debug("Data notification received in state " + AppState.currentState, remoteMessage, SylkNative); - if(AppState.currentState == "background") { + if(AppState.currentState == "background" && remoteMessage.data.event === 'incoming_session') { //rnn_hasRNHost indicates if the app has a react native host when the notification was received. This is used to determine if the app was in the background or dead. If it was dead then launch the main activity to wake enough of the phone to be useful. SylkNative.launchMainActivity(); } return Promise.resolve(); } \ No newline at end of file