-3

Is it possible, that my Android App (and the same Question for iOS) does some last task, if the user unistalls it (I want that the app notifies the server, that the app is no longer on the device).

My only idea is, that the server pushes a message, and if the device does not answer after a certain ammount of time, the Server assumes, that the app is no longer on the device. But if the user just turns the phone off, the Server could accidentaly delete the Profile.

Thanks in advance.

Luca Thiede
  • 3,229
  • 4
  • 21
  • 32

2 Answers2

1

I don't know about Android but on iOS, the answer is no. There is not such method which will do something for you once you delete the app. For example there is no "applicationDidGetDeleted"... lol.

The only possible way I can think of, is if your app uses push notifications. Your server will have to keep a list of all users which have allowed push notifications to be sent to. Once they delete the app, the server will not be able to send them anymore push notifications and thus you know that the app has been deleted.

This can then be used to create a list of users who have deleted your app on your server. But if you are looking to run some kind of method on iOS once your app gets deleted, then no, you can't do that.

1

Similarly on Android, there is no supported means of finding out, on-device, that your app is about to be uninstalled.

With respect to GCM, though, IIRC you will find out from the GCM server when somebody has uninstalled your app (or otherwise unregistered it from GCM), if you try to send a message to them. There's a specific return code from the REST API for it (again, IIRC).

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Ok, that should work for me. Is unistalling the app the only way to unregister from GCM, or could this accidentally happen on another way? (for example if the user just closes the app, or turns the device off) – Luca Thiede Mar 18 '15 at 15:33
  • @LucaThiede: Definitely not in those two cases. One scenario that I am uncertain of is if the user goes into Settings, finds your app in the list of installed apps, and clicks the "Clear Data" button. – CommonsWare Mar 18 '15 at 15:36