让从自己的服务器发送的PushNotifications在Android后台可见。

问题描述 投票:-1回答:1

在我的Ionic App中,我通过Firebase Cloud Messaging从我自己的服务器接收推送通知。我正在发送通知与一个帖子请求到 https://fcm.googleapis.com/fcm/send. 他们有 data 钥匙组,有 title, a bodycontent-available 发送到1。

在我的应用中,我使用Capacitor的推送通知插件来接收通知,像这样。

 PushNotifications.addListener('pushNotificationReceived', (notification: PushNotification) => {
   alert('Push received ' + JSON.stringify(notification));
 });

当应用程序打开并可见时,它的工作原理是一样的, 但当它在后台时,什么都没有发生,直到我再次打开它。有什么办法可以让我在App处于后台的时候收到这个消息吗?

android ionic-framework push-notification ionic2 capacitor
1个回答
0
投票

如果你已经按照这里的步骤进行了操作,那么你就会发现,你的电脑已经被盗了。火库与安卓应用 指南。

  1. 在您的设备上重新安装(必须先卸载)该应用。
  2. 在这里插入你的设备令牌,如下图所示。

insert FCM token here

© www.soinside.com 2019 - 2024. All rights reserved.