Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29622

Notification sound not working in react native firebase v6?

$
0
0

I'm sending a notification to users it's received it but without any sound "default device sound"

I add a sound: 'default' in notification payload but still not works!

here's my function

// Send notification for user when his order is accepted "status : pendding"exports.acceptOrder = functions.database  .ref('/Providers/ProvidersOrders/InProgress/{providerUid}/{orderId}')  .onCreate(async (snapshot, context) => {    console.log('snapshot', snapshot.val());    const {userUID} = snapshot.val();    const userRef = await admin      .database()      .ref(`/users/${userUID}`)      .once('value');    const {userToken, username} = userRef.val(); // FCM user app token    try {      const options = {        priority: 'high',        contentAvailable: true,      };      const payload = {        notification: {          title: 'Accepted order',          body: `Hey! ${username}, your order has accepted we will contact with you as soon as possible.`,          timestamp: Date.now().toString(),          isRead: 'false',          sound: 'default',        },      };      let {sound, ...notification} = payload.notification;      let uid = userUID;      await admin        .messaging()        .sendToDevice(userToken, payload, options)        .then(() => {          return admin            .database()            .ref(`Notifications/${uid}`)            .push({...notification});        });      console.log('message sent');    } catch (error) {      console.log('Error sending message:', error);    }    return null;  });

So what's the wrong here?


Viewing all articles
Browse latest Browse all 29622

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>