EddyVerbruggen / nativescript-local-notifications

:mailbox: NativeScript plugin to easily schedule local notifications
MIT License
162 stars 57 forks source link

Ability to Create Silent notification channel in Android #163

Open NikolayBa opened 5 years ago

NikolayBa commented 5 years ago

As a requirement for our app, we needed to create a silent notification channel. (doesn't pop, just stays ongoing)

Whenever creating a Notification channel, we would set it the following way with native code:


let NOTIFICATION_CHANNEL_ID = "org.nativescript.TestAndroidNotification";
let channelName = "Ongoing Test notification";

const chan = new (<any>android.app).NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, (<any>android.app).NotificationManager.IMPORTANCE_LOW);

chan.setLockscreenVisibility((<any>android.app).Notification.VISIBILITY_PRIVATE);

Further, when using the plugin, if I use the same channelName for the "channel" property, this ends up creating a new channel with the same name. So as a workaround, only this notification is created natively.

Just figured it would be useful to have this feature in the plugin, so might as well log it