新站推送并执行代码
我可以将我的应用程序设置为报亭应用程序,关闭该应用程序,然后发送将触发后台下载操作的推送通知吗?
我需要添加到通知中的有效负载是什么?
我已添加内容可用 1,但应用程序中没有任何反应。它没有醒来。
当应用程序处于睡眠状态时,我已成功收到其他警报通知,因此我知道推送有效......它们只是不会唤醒应用程序。
Can I set my app as a newsstand app, close the app, then send a push notification that will trigger a background download operation?
What is the payload I need to add to my notification?
I've added content-available 1 and nothing in the app happens. It's not woken up.
I've successfully received other alert notifications when the app is asleep, so I know the pushes work..... they just won't wake up the app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是/解决方案是:
我正在使用 "content-available":"1" ..... 当我应该做 "content-available":1
...没有 1 周围的引号
时。所以.. ..
{"aps": {"content-available":1,"alert":"内容测试","badge":0,"sound":"default"}, "device_tokens": ["my-device-token- gos-here"]}
被视为报亭的后台通知,而如果我引用 1,它会作为普通的推送通知出现在设备上!
希望这对其他人有帮助。
The problem was / solution is:
I was using "content-available":"1" ..... when I should have been doing "content-available":1
...without the quotes around the 1.
So....
{"aps": {"content-available":1,"alert":"content test","badge":0,"sound":"default"}, "device_tokens": ["my-device-token-goes-here"]}
is treated as a background notification for newsstand, whereas if I quote the 1 it appears on the device as a normal push notification!
Hope this helps someone else.