应用关闭时,Firebase IOS推送通知无效

时间:2022-12-14 20:39:14

Firebase IOS push notification doest not work when app is closed. I have followed all the steps as in documentation

关闭应用时,Firebase IOS推送通知功能无效。我已按照文档中的所有步骤操作

3 个解决方案

#1


8  

It's a quick fix, simply add "priority": "high" in your payload next to "notification" etc. and the iOS Notification will work when the app is in the background.

这是一个快速修复,只需在“通知”等旁边的有效负载中添加“优先级”:“高”,当应用程序在后台时,iOS通知将起作用。

So this will work:

这样可行:

"to":"TOKEN ID",
"notification" : {
  "body" : "test"
},
"priority": "high"
}

#2


0  

What worked for me was simply adding title to the notification like this:

对我有用的只是在通知中添加标题,如下所示:

"notification" : {
  "title": "foo",
  "body" : "bar"
}

#3


0  

Please try with this, hope it works:

请试试这个,希望它有效:

POST https://gcm-http.googleapis.com/gcm/send
{
    "to": "TOKEN_ID",
    "priority": "high",
    "notification": {
        "title": "foo",
        "body": "bar"
    }
}

#1


8  

It's a quick fix, simply add "priority": "high" in your payload next to "notification" etc. and the iOS Notification will work when the app is in the background.

这是一个快速修复,只需在“通知”等旁边的有效负载中添加“优先级”:“高”,当应用程序在后台时,iOS通知将起作用。

So this will work:

这样可行:

"to":"TOKEN ID",
"notification" : {
  "body" : "test"
},
"priority": "high"
}

#2


0  

What worked for me was simply adding title to the notification like this:

对我有用的只是在通知中添加标题,如下所示:

"notification" : {
  "title": "foo",
  "body" : "bar"
}

#3


0  

Please try with this, hope it works:

请试试这个,希望它有效:

POST https://gcm-http.googleapis.com/gcm/send
{
    "to": "TOKEN_ID",
    "priority": "high",
    "notification": {
        "title": "foo",
        "body": "bar"
    }
}