新站推送并执行代码

发布于 2024-12-13 10:08:22 字数 184 浏览 1 评论 0原文

我可以将我的应用程序设置为报亭应用程序,关闭该应用程序,然后发送将触发后台下载操作的推送通知吗?

我需要添加到通知中的有效负载是什么?

我已添加内容可用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

丶情人眼里出诗心の 2024-12-20 10:08:22

问题是/解决方案是:

我正在使用 "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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文