1

I'm using Android Parse API for push notifications (v1.9.4) and I would like to know how to clean up Parse app data (Installation, User and Session objects) as the app is uninstalled by the user. Is this possible at all? I have seen some posts from 2-1 years ago that indicates that such is not possible and I wonder if things got different and if there are new workarounds for it:

These posts above only refer to the installation object removal, and I could not find info on the web on how to remove the session and the user data. I really need to clean up everything or else weird things happen such as ParseException "username XXX already taken" when some user tries to sign up (by calling signUpInBackground) after re-installation of the app, not to mention the redundant notifications sent for ghost parse installations...

Much appreciated for any help!

Dr Jorge
  • 353
  • 9
  • 15
  • Does android tell an app (run it, I guess) that its being removed? I doubt it (even before reading this: http://stackoverflow.com/questions/6209730/is-it-possible-to-detect-android-app-uninstall). Since probably no, then probably no to your question. Consider measuring inactivity over some long period as a heuristic for uninstall. – danh Aug 19 '15 at 02:09
  • Thanks danh, I have used cloud code with a beforeSave trigger on ParseInstallation to detect duplicate installations objects for a given user. And now, in spite of not having anymore duplicate installations, I continue to get the error "username XXX already taken" on signUpOnBackground... Of course user already exists and I was expecting parse to handle these situations but apparently this is another limitation of parse... Do you have any idea on how to overcome this problem? Should I use a fallback method in case this happens? – Dr Jorge Aug 19 '15 at 23:31
  • Why do you call this a limitation ? You can't have multiple users with the same username, it's a feature, not a limitation. And this is linked to the User table, not the Installation table. – deadbeef Aug 20 '15 at 10:57
  • @deadbeef you misunderstood what I said. My point is that parse should automatically login a user (that already exists) when we are trying to sign him up again, or at least give a fallback method or an error code so that the programmers can handle better this issue of when a user signs up again after reinstallation of the app. Because of this "limitation", the programmers have to check if users exist on Parse, before signing them up... Do you got it now or need more explanations? – Dr Jorge Aug 20 '15 at 21:17

1 Answers1

0

You can detect if the user uninstall the application but you can avoid the issue with some work.

For example, I've added a new column in the Installation which save a pointer to the User so next time the user login I search and delete the previous Installation of this user to create the new one after. This way you will only have one installation (with device token included) per user.

I know, it's little ugly but it's the only way to avoid this Parse limitation.

Arturo
  • 548
  • 6
  • 15
  • Thanks Arturo, I have used cloud code with a beforeSave trigger on ParseInstallation to detect duplicate installations objects for a given user. And now, in spite of not having anymore duplicate installations, I continue to get the error "username XXX already taken" on signUpOnBackground... Of course user already exists and I was expecting parse to handle these situations but apparently this is another limitation of parse... Do you have any idea on how to overcome this problem? Should I use a fallback method in case this happens? – Dr Jorge Aug 19 '15 at 23:31