Skip to content

Added createNotificationChannelAndroid feature

Compare
Choose a tag to compare
@andrehtissot andrehtissot released this 24 Apr 14:50
· 186 commits to master since this release
72cca36

For Android, some notification properties are only defined programmatically, one of those is channel.
Channel can define the default behavior for notifications on Android 8.0+.
This feature was meant to bring the channel-only configurations importance and visibility:

FCMPlugin.createNotificationChannelAndroid({
  id: "urgent_alert", // required
  name: "Urgent Alert", // required
  description: "Very urgent message alert",
  importance: "high", // https://developer.android.com/guide/topics/ui/notifiers/notifications#importance
  visibility: "public", // https://developer.android.com/training/notify-user/build-notification#lockscreenNotification 
});

! Once a channel is created, it stays unchangeable until the user uninstalls the app. !

To have a notification to use the channel, you have to add to the push notification payload the key android_channel_id with the id given to createNotificationChannelAndroid (https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support)

Special thanks to @sajhu for requesting this feature.