如何捕获设备上的应用程序卸载并让服务器知道这一点(iOS/Android)
问题描述:
我们有一项服务,其中包含适用于主要移动操作系统的应用程序。我们使用推送通知。当用户登录时,我们存储他的设备授权数据(比如说令牌)以供以后在推送服务中使用。问题在于一个用户的设备授权很少,并且当用户卸载应用程序时正确地保持它们有效。
示例:
我将系统登录信息提供给了一些人,以供尝试。他们通过暴徒登录。应用程序和系统自动将一些设备授权添加到数据库(令牌)中。所以现在我们有 1 个用户的 N 个设备令牌。这样,如果我们发送推送通知,每个人都会收到它。现在,假设那些已安装应用程序的人想要卸载它。无需注销,他们就可以通过应用程序管理器卸载应用程序。目前我们没有授权设备的有效数据。如果我们尝试通知他们,通知将无处发送。这是错误的,并且对服务器来说是无用的工作。如何让核心知道某些存储的数据不再有效?
简短地说 - Android / iOS 中是否有可能触发应用程序删除事件。如果应用程序正在删除,则调用服务器来清理存储中的数据。或者,如果应用程序打开并且用户卸载它,是否会触发 onDestroy() 触发器?还是其他?
我不是 iOS 开发人员,也不是 Android 开发人员,只是对第二个了解一点,对第一个一无所知。任何建议将不胜感激。提前致谢。
Problem Description:
We have a service which has applications for main mobile OS’s. We use push notifications. When user is log in, we store his device authorization data (lets say token) for later use in the push service. The problem is about few device authorizations for one user and properly keeping them valid when the user uninstall the application.
Example:
I gave my login to system to a few people, in case to try it. They logged in through the mob. application and the system automatically add a few device authorizations into database (tokens). So now we have N device tokens for 1 user. So that if we send push notification everyone will receive it. Now, suppose those who have installed applications want to uninstall it. Without logout they uninstall application through application manager. And at this time we have NOT VALID data for authorized device. And if we try to notify them, notification will be sent nowhere. Which is wrong, and useless work for server. How to let the core know that some of stored data is no longer valid?
Shortly – is there any possibility in Android / iOS to trigger application delete event. If the application is being delete application call server to clean-up data in the storage. Or if the application is open and the user uninstall it, would there onDestroy() trigger fired? Or some other?
I’m not iOS developer, not Android developer, just know a little about second one and nothing of the first. Any advice will be appreciated. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不能代表 iOS 说话。当您的应用程序在 Android 中卸载时,您将无法获得控制权。
I cannot speak for iOS. You cannot get control when your application is uninstalled in Android.
这取决于您使用的推送服务。 Afaik,如果您正在使用 C2DM,卸载应用程序的行为会自动从 C2DM 取消注册。
编辑:
哦,关于 iOS - 据我所知,它不会直接跟踪已卸载的应用程序,但它确实会附带失败通知反馈服务,在一系列失败的通知(由设备报告给推送网络)会通知您 - 允许您在卸载应用程序后进行清理。
That depends on which push service you are using. Afaik, if you are using C2DM, the act of uninstalling the application will automatically unregister it from C2DM.
Edit:
Oh, and about iOS - afaik it does not directly track uninstalled apps, it does however come with a failed notification feedback service that after a sequence of failed notifications (reported by the device to the push network) will notify you - allowing you to clean up after an uninstalled app.