cordova-plugin-firebase-messaging icon indicating copy to clipboard operation
cordova-plugin-firebase-messaging copied to clipboard

Added support for notification channels

Open grumpygary opened this issue 2 years ago • 2 comments

This is my first PR ever, so I apologize if I got it wrong.

I've brought the Android 6.x notification channel implementations forward to 7.x. That said, you still create a default channel called "Firebase" that would be nice to be able to skip based on some sort of config.

Anyway, I hope you find this useful.

-Gary

grumpygary avatar Jan 10 '23 17:01 grumpygary

That said, you still create a default channel called "Firebase" that would be nice to be able to skip based on some sort of config.

If you don't want the Firebase channel you can comment out the below (FirebaseMessagingPluginService.java, line 57)

// On Android O or greater we need to create a new notification channel
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            NotificationChannel defaultChannel = notificationManager.getNotificationChannel(defaultNotificationChannel);
            if (defaultChannel == null) {
                notificationManager.createNotificationChannel(
                        new NotificationChannel(defaultNotificationChannel, "Firebase", NotificationManager.IMPORTANCE_HIGH));
            }
        }

fredriksthlm avatar Jan 10 '23 17:01 fredriksthlm

That said, you still create a default channel called "Firebase" that would be nice to be able to skip based on some sort of config.

If you don't want the Firebase channel you can comment out the below (FirebaseMessagingPluginService.java, line 57)

// On Android O or greater we need to create a new notification channel
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            NotificationChannel defaultChannel = notificationManager.getNotificationChannel(defaultNotificationChannel);
            if (defaultChannel == null) {
                notificationManager.createNotificationChannel(
                        new NotificationChannel(defaultNotificationChannel, "Firebase", NotificationManager.IMPORTANCE_HIGH));
            }
        }

Thanks. I have a version where I did that. I mentioned it above b/c it would be nice to have the ability to turn it off via a config.xml setting.

grumpygary avatar Jan 11 '23 18:01 grumpygary