Firebase push notification custom sound is not working

Viewed 575

I have created a tool to test firebase push notifications of my project and I have added a custom sound for the notifications. Custom sound is working properly on IOS but in android some devices play the default sound instead of custom one.

Below I have shared my code. can anyone please help me? Thanks in advance.

var registrationToken = 'YOUR_REGISTRATION_TOKEN';

var message = {
  notification: {
    title: 'Title',
    body: 'Body',
  },
  android: {
    priority: 'high',
    notification: {
      sound: 'ringing.mp3',
      defaultVibrateTimings: true,
    },
  },
  apns: {
    payload: { aps: { sound: 'ringing.mp3', badge: 0 } },
  },
  token: registrationToken,
};

admin
  .messaging()
  .send(message)
  .then(response => {
    console.log('Successfully sent message:', response);
  })
  .catch(error => {
    console.log('Error sending message:', error);
  });

0 Answers
Related