capacitor-community / fcm

Enable Firebase Cloud Messaging for Capacitor apps
https://capacitor.ionicframework.com/docs/
MIT License
238 stars 83 forks source link

custom sound not working android 8+ #118

Closed apri23 closed 1 year ago

apri23 commented 1 year ago

why custom sound not working on android 8+. is there any additional setup?

jcesarmobile commented 1 year ago

On Android 8+ sounds are bound to notification channels, so to use a custom sound you have to create a notification channel first with the sound configured and then configure the push notification payload to be delivered to the existing channel. I don't think this plugin provides an API for creating notification channels, you can use @capacitor/local-notifications for creating channels (despite the name is local-notifications, notification channels are for local and for push notifications).

Note that users can change the channel sound from the app settings, so on Android 8+ it's not possible to guarantee that the sound is the one the developer wants.