禁用应用程序中的推送通知
我想知道是否有一种方法可以在不使用注销的情况下禁用推送通知。
请帮忙
I want to know if there is a way to disable Push notifications without using unregister.
Please help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它非常简单,因为 iPhone 本身就有启用或禁用推送通知功能的功能。
在 iPhone 中按照以下步骤操作:
Its very simple because iPhone itself got a feature to enable or disable Push Notification feature.
Follow these steps in iPhone:
不,没有,但为什么需要呢?至少默认情况下不是。像 Urban Airship 这样的提供商会为您提供一些安静的时间段,让您在给定的时间段内不会收到消息。但毕竟,您的服务器通常是发送推送通知的服务器,因此应该可以实现停止时间。
Nope, there isn't, but why would you need to. At least not by default. Providers like urban Airship give you thinks like quite periods, that allow you to not receive message for a given time period. But after all, your server is usually the one sending out the push notifications, so it should be possible to implement stop times.
你可以用 php 和数据库做一些事情。它有点复杂,但可能对你有用。我们假设运行该应用程序的所有设备都将其设备令牌推送到数据库。在该数据库中,您有 2 列。一种用于设备令牌,另一种将被称为“跳过”或“禁用”。在应用程序中有一个按钮,上面写着“禁用推送”或类似的内容。当用户按下该按钮时,使用 nsurl 将设备令牌通过 php 使用 post 发送到脚本。该脚本将在该数据库中找到发送设备令牌的行,并将 yes 或 1 放入该设备令牌的跳过或禁用列中。当您要发送推送通知时,首先让脚本检查跳过/禁用列是否等于 yes/1。如果确实跳过该设备令牌并转到下一个。
如果您需要编码方面的帮助,我很乐意提供帮助。
You can do some stuff with php and databases. It's a bit complex but it might work for you. Let's assume that all the devices that run that app push their device tokens to a database. In that database you have 2 columns. One for the device token and one that will be called something like skip or disabled. In the app have a button that will say like disable push or something like that. When the user presses that button use a nsurl to send the device token with php using post to a scripts. That script will find the row in that database with the device token send and put either yes or 1 in the skip or disabled column for that device token. When you go to send the push notification first have the script check to see if the column skip/disabled equals yes/1. If it does skip that device token and go to the next one.
If you need help with the coding I'm willing to help.