HOWTO删除设备令牌由苹果APNS收到的反馈意见 [英] HOWTO remove device tokens received by Apple APNS feedback

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

问题描述

我顺利通过PHP获取苹果的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.

Regardz,

Mladjo

推荐答案

时间戳是这里的关键因素。由苹果发送时间戳指示最后一次推送服务试图传递消息给设备,发现要卸载的应用程序。自那时以来,如果设备与您的服务重新注册就没有必要将其删除。

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.

因此​​,每一次你的应用程序加载,并将令牌为您服务,您需要进入数据存储的时间。当您运行的反馈,你应该从苹果的检查时间,并将其与上次收到的更新从设备上的应用程序的时间。如果苹果发送时间是较新的,那么你收到的更新,那么你应该删除(或禁用)设备的时间。如果苹果的时间早是那么你就需要删除它,因为用户已经重新安装,因为苹果上次尝试交付设备。

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删除设备令牌由苹果APNS收到的反馈意见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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