当应用程序在前台时,推送通知不显示

时间:2019-08-08 06:38:50

标签: push-notification

嗨,我在firebase Push Notifications中遇到问题,我可以在后台的应用程序中获取通知,但在前台的应用程序中却无法获取通知。我进行了很多搜索,但没有找到合适的解决方案,请帮助。下面是我的源代码。

notification: {
                      title: 'Hey! ?',
                      body: `Check Choice of the day.`,
           
                    }
                  };

   return admin.messaging().sendToDevice(DeviceToken, payload)
        .then(function(response){
             console.log('Notification sent successfully:',response);
        }) 
        .catch(function(error){
             console.log('Notification sent failed:',error);
        });

0 个答案:

没有答案