如何设置 RSS 类型的通知服务?
背景:我在 iOS 和 Android 上设置了一个 PhoneGap 应用程序,其中的插件允许我在应用程序处于后台时对系统/本地通知进行排队。我知道如果应用程序退出或终止,或者自安装/开机后尚未启动,它将无法工作,但这些并不是太重要。
我想要做的是创建一个数据库来保存通知(与应用程序名称关联),并让应用程序定期(5 分钟?)向服务器发出 getJSON 请求(jQuery)并检索任何通知。
我想知道的是 - 如何让设备知道应该从服务器提取哪些通知,而无需重复通知?我是否需要存储设备检索到的每个通知的 ID 以确保它不会重复?这似乎会在设备上存储大量不必要的数据,并且如果清除本地数据可能会变得混乱。我想这会像 RSS 一样发挥作用,因为它会获取最新的信息,但不会重复。
Background: I have a PhoneGap application set up on iOS and Android with plugins that allow me to queue system/local notifications when the app is in the background. I know that it won't work if the app was quit or killed, or if it hasn't been started since install/power on, but these are not too important.
What I want to do is create a database that will hold notifications (associated with an app name), and have the app periodically (5 minutes?) do a getJSON request (jQuery) to the server and retrieve any notifications.
What I want to know is - how can I make the device know which notifications it should pull from the server, without ever duplicating one? Do I need to store the id of every notification the device has ever retrieved to ensure it doesn't get duplicates? This seems like it would store a lot of unnecessary data on the device and could get messed up if local data is cleared. I guess this would function like an RSS in that it would get the most recent info, but not duplicate.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论