EddyVerbruggen/nativescript-local-notifications

Can't set priority for Android heads-up notification

rchisholm opened this issue · 6 comments

Hello,

Thank you so much for this plugin. It is has been very helpful for my app's purposes, where push notifications would have been overkill.

However, I find that I am unable to create heads-up notifications. There is no "priority" property, as referenced in issue #98, and I see that heads-up notifications are referenced in issue #69, however this issue recommends using the property "forceShowWhenInForeground" to true, which does not create a heads-up notification (though it does create a regular notification while the app is in the foreground).

Any help would be greatly appreciated. Thanks again!

Can you educate me on what a 'heads-up' notification is, and how it's different from one that shows in the foreground (because that's what I thought was meant).

From developer.android.com

Heads-up notification
Beginning with Android 5.0, notifications can briefly appear in a floating window called a heads-up notification. This behavior is normally for important notifications that the user should know about immediately, and it appears only if the device is unlocked.

heads-up_2x

Figure 3. A heads-up notification appears in front of the foreground app

The heads-up notification appears the moment your app issues the notification and it disappears after a moment, but remains visible in the notification drawer as usual.

For me, when using the option "forceShowWhenInForeground," the notification displays in the standard notification drawer while the app is in the foreground, but doesn't show the notification in the foreground, if that makes any sense. The heads-up notification needs to show as a floating window with text (like the default notifications in iOS), not just an icon in the notification drawer, which then shows the notification text and icon when dragged down (like default notifications in Android).

Any update? Would be useful to have this available.

@Lehren The main problem is that I'm not entirely sure about the implementation. Would it suffice to expose a priority property which takes a number and is passed to this line?

@EddyVerbruggen
For me that would be fine if possible.

Alright, available now in 4.1.2. See the readme (look for priority).