roblav96 / nativescript-onesignal

A Nativescript plugin that wraps the iOS and Android OneSignal Push Notifications SDK.
https://documentation.onesignal.com/docs/getting-started
Other
24 stars 42 forks source link

How to determine NotificationReceivedHandler is foreground or background? #30

Open LSmint opened 6 years ago

endymion00 commented 6 years ago

@LSmint I suggest you to check the properties that topmost contains. I use this to check if the app its being launched (so was killed) and I think when the app is in background currentEntry is null (but I have not checked)

const frameTopmost = frameModule.topmost(); // check frameTopmost.currentEntry and maybe other properties.