发送通知有效载荷ionic 3时,云firestore声音不起作用

时间:2018-08-11 05:44:24

标签: firebase ionic3 firebase-cloud-messaging

这是代码,我正在使用admin.messaging功能将通知发送给使用某些选项的设备,但它工作正常,但没有声音或选项起作用?

admin.document('users/{userId}/follower/{followerId}').onCreate((event,
 context) => {

     const data = event.data();

     let usersData = '';
     const tokens = [];

     // Notification content
     const db = admin.firestore()
     db.collection('users').doc(context.params.userId).get().then(a => {
       a.map(data =>{
         console.log(data);
       })
       return true;
   }).catch(b => {
       return b;
     });


     const payload = {
       notification: {
         title: 'New Follower',
         body: usersData.name ? usersData.name : `dummy` + ` is following your content!`,
         not working > sound:'default'
       }
     }

     const options = {
       priority: "high",
       timeToLive: 60 * 60 * 24
     };



     return db.collection('devices').where('userId', '==', context.params.userId).get()
       .then(a => {
         return a;
       })
       .then((devices) => {
         devices.forEach(result => {
           const token = result.data().token;

           tokens.push(token)
         });
         return admin.messaging().sendToDevice(tokens, payload, options)
       }).catch(b => {
         return b;
       })

0 个答案:

没有答案