Steffaan / cordova-plugin-local-notifications

Cordova Local Notifications Plugin
Apache License 2.0
31 stars 38 forks source link

Is it possible to play different audio for each different notifications for android #22

Closed erdemakca1 closed 5 years ago

erdemakca1 commented 5 years ago

I can set a notification with a custom mp3, but when I set another notification with another mp3, the first mp3 that I set plays. In all notifications, the mp3 that belongs to the notifications that was set first is playing.

How do I force a notification sound to be set as another sound?

I would appreciate your help. Thanks.

Your Environment

Expected Behavior

Playing sound specially set for notification

Actual Behavior

Even if multiple notifications have their own sounds, the sound of the first set of notification plays

Steps to Reproduce

  1. Set notification with a custom sound for example torpedo.mp3
  2. Set another notification with a custom sound for example rooster_crow.mp3
  3. Plays torpedo.mp3 when first notification triggered. That is true
  4. Plays torpedo.mp3 when second notification triggered. That is unwanted. Notification must play rooster_crow.mp3 audio
Steffaan commented 5 years ago

First upgrade your plugin to the latest version. The version of the plugin in this fork is 0.9.3. There is no 0.9.0-beta.2.

And yes it's possible, by using multiple channels. Android changed their notification mechanism and each channel has its own settings regarding to vibration / sound.

By using different channels for each type of notification you can declare a unique sound per channel.

erdemakca1 commented 5 years ago

Thanks a lot. I did it by defining separate channels for each notification with different voice.