HOWTO 移除 Apple APNS 反馈收到的设备令牌 [英] HOWTO remove device tokens received by Apple APNS feedback

查看:26
本文介绍了HOWTO 移除 Apple APNS 反馈收到的设备令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已成功通过 PHP 获取 Apple APNS 反馈数据.我得到的结构(经过一些处理)看起来像这样:

I am successfully fetching Apple APNS feedback data via PHP. The structure that I am getting (after some processing) looks something like this:

时间戳

设备令牌

我的问题是如何知道我应该从数据库中删除哪些设备令牌并停止向它们发送通知.

My question is how to know which of the device tokens should I remove from my database and stop sending notifications to them.

问候,

姆拉乔

推荐答案

时间戳是这里的关键元素.Apple 发送的时间戳表示推送服务最后一次尝试向设备传递消息并发现要卸载的应用程序的时间.如果此后设备已重新注册到您的服务,则无需将其删除.

The timestamp is the crucial element here. The timestamp sent by Apple indicates the last time the push service attempted to deliver a message to the device and found the app to be uninstalled. If the device has re-registered with your service since then there is no need to delete it.

因此,每次您的应用加载令牌并将令牌发送到您的服务时,您都应该在数据存储中记录时间.当您运行反馈时,您应该检查来自 Apple 的时间并将其与您上次从设备上的应用程序收到更新的时间进行比较.如果 Apple 发送的时间比您收到更新的时间更新,则您应该删除(或禁用)该设备.如果来自 Apple 的时间更早,那么您不需要删除它,因为自 Apple 上次尝试交付以来,用户已经重新安装了设备.

Therefore, every single time your app loads and sends the token to your service, you should log the time in your data store. When you run feedback you should check the time from Apple and compare it to the time you last received an update from the app on the device. If the time Apple sends is newer then the time you received an updated then you should delete (or disable) the device. If the time from Apple is earlier then you do not need to delete it because the user has reinstalled the device since Apple last tried to deliver.

这篇关于HOWTO 移除 Apple APNS 反馈收到的设备令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆