eri*_*ccc 6 notifications ios google-cloud-messaging
我将我的iOS应用程序设置为通过GCM接收推送通知.完成所有设置后,当应用程序在各种Apple设备上处于前台时,我能够收到通知.但是,当应用程序在后台时,我只会收到某些设备的推送通知,即只有我的iPhone 6.其他设备,如iPhone 5s和iPod Touch,只能在应用程序位于前台时捕获通知.
我查看了其他人关于这个问题的问题,我还没有看到一个特定于设备模型的问题.通常它归结为不设置content_available: true设置,但我设置它.以下是我正在使用的有效负载的示例:
{
"to":".....",
"content_available":true,
"notification": {
"title":"my title",
"body":"my body",
"sound":"default"
}
}
Run Code Online (Sandbox Code Playgroud)
我收到了这个背景通知,确切地说我想要在我的iPhone 6上(我的手机被唤醒,我看到一个横幅),但其他设备(也使用iOS v8.4.1)在应用程序时不响应通知在后台.
其他详情:
任何想法将不胜感激.
eva*_*ent 16
您应该将priority参数添加到您的请求中.例如
{
"to":".....",
"content_available":true,
"priority": "high", // Add this field corresponds to 10 for APNS
"notification": {
"title":"my title",
"body":"my body",
"sound":"default"
}
}
Run Code Online (Sandbox Code Playgroud)
以下是提及该领域的GCM参考priority.如果您没有设置优先级,则通过Normal优先级发送消息,这在APNS的情况下是高度可变的.
| 归档时间: |
|
| 查看次数: |
6146 次 |
| 最近记录: |