简体   繁体   English

Android:在应用卸载时从远程数据库中删除记录

[英]Android: Delete record from remote database on app uninstall

I have written an application ( AirQApp ) for general public as well as for our customers. 我已经为公众以及我们的客户编写了一个应用程序( AirQApp )。 When customers log in with the given username and password, it stores the device registration ID in the central database to generate gcm notifications for the specific customer similarly when they logout it deletes the device ID, but when they uninstall this application, it cannot delete the device ID from the database hence notifications are still generated. 当客户使用给定的用户名和密码登录时,它将device registration ID存储在中央数据库中,从而为特定客户生成gcm通知,类似于他们注销时删除设备ID的情况,但是当他们卸载此应用程序时,无法删除该设备的ID。数据库中的设备ID,因此仍会生成通知。

I googled it and it seems like it is not possible to perform a task on application uninstall. 我用谷歌搜索,似乎无法执行应用程序卸载任务。 Is there any other solution which can be applicable in my scenario? 还有其他适用于我的方案的解决方案吗? Is there any way to check if the application is installed on a particular device from device registration ID? 是否可以通过设备注册ID检查应用程序是否安装在特定设备上?

Thanks in advance. 提前致谢。

  1. The end user uninstalls the application. 最终用户将卸载该应用程序。
  2. The 3rd-party server sends a message to GCM server. 第三方服务器向GCM服务器发送一条消息。
  3. The GCM server sends the message to the device. GCM服务器将消息发送到设备。
  4. The GCM client receives the message and queries Package Manager about whether there are broadcast receivers configured to receive it, which returns false. GCM客户端接收到该消息,并向程序包管理器查询是否有配置为接收该消息的广播接收器,该接收器返回false。
  5. The GCM client informs the GCM server that the application was uninstalled. GCM客户端通知GCM服务器该应用程序已卸载。
  6. The GCM server marks the registration ID for deletion. GCM服务器将注册ID标记为删除。
  7. The 3rd-party server sends a message to GCM. 第三方服务器向GCM发送一条消息。
  8. The GCM returns a NotRegistered error message to the 3rd-party server. GCM向第三方服务器返回NotRegistered错误消息。
  9. The 3rd-party deletes the registration ID. 第三方删除注册ID。

From Here 这里

I googled it and it seems like it is not possible to perform a task on application uninstall 我用谷歌搜索,似乎无法执行应用程序卸载任务

Correct. 正确。

Is there any other solution which can be applicable in my scenario? 还有其他适用于我的方案的解决方案吗?

The next time you try to send a message to that GCM registration ID, GCM should tell you that it is no longer registered . 下次您尝试向该GCM注册ID发送消息时,GCM会告诉您该消息已不再注册

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM