Local Notifications--Display while App is in Foreground?


#1

I have been testing the local notifications plugin:https://github.com/EddyVerbruggen/nativescript-local-notifications. It’s great. The limitation I see is that it displays a notification only if a user has exited the app (ie, the app is in the background–the app repo expressly says that this is the functionality–show notifications when user has exited the app). Is there a way to show local notifications even if the app is in the foreground?

The biggest reason for this is that if a user is using the app, and then the screen is locked, the notification will not show. So the phone will be on the lock screen–prime time for notifications–but the notification will not show because the user never exited out of the app, so the system thinks the app is still in the foreground.


#2

If device is locked while app in foreground that is also considered as paused / suspended state only.

Besides at least Android always allows you to show a notification in the tray no matter the app is in foreground or background, but iOS limits it to background only at least till iOS v10.


#3

Thanks. Looks like in iOS 10 there may be a method, but I have not tested it:https://stackoverflow.com/questions/30852870/displaying-a-stock-ios-notification-banner-when-your-app-is-open-and-in-the-fore