no sound in a push notification on Android(Ionic capacitor)

Viewed 390

I have a problem when i implemented a plugin PushNotification in capacitor, the problem is that when te phone receive a push notification don´t make any sound. This is my code.

PushNotifications.addListener('pushNotificationReceived',
  (notification: PushNotification) => {
    console.log('Push received: ',JSON.stringify(notification));

  }

this is the settings in capacitor.config.json

"PushNotifications": {
  "presentationOptions": ["badge", "sound", "alert"]
}

thanks for your help.

1 Answers

show me the created the Notification channel Details.
Then don't test in Redmi or mi Phones.

addListenersForNotifications = async () => {
   await PushNotifications.addListener('registration', 'registration Name');
await PushNotifications.addListener('registrationError', 'error');
await PushNotifications.createChannel({
  id: 'fcm_default_channel',
  name: 'app name',
  description: 'Show the notification if the app is open on your device',
  importance: 5,
  visibility: 1,
  lights: true,
  vibration: true,
});
await PushNotifications.addListener('pushNotificationReceived', this.pushNotificationReceived);
await PushNotifications.addListener('pushNotificationActionPerformed', this.pushNotificationActionPerformed);

};

Related