0

I realize that this problem can be solved in the future by using some sort of SharedPreferences value that contains the app version and is set only on the very first run. However, I'm considering adding ads to one of my apps and I'd like to not bombard existing users with ads without offering more value to them.

I was wondering, therefore, if there is some sort of innate property that would let me detect this, or if it's too late to do it for this version as I would have needed to implement that beforehand. Unfortunately, the app is very simple and so at the moment I haven't even used any preferences. Thanks!

(I considered asking this on AndroidEnthusiasts, but I reasoned that it really is an SDK question that devs would be better able to answer)

MalcolmOcean
  • 2,807
  • 2
  • 29
  • 38
  • Does your existing version of the app save anything at all to `SharedPreferences` or the file system? – Squonk Jul 30 '12 at 22:33
  • Are you using *any* files? A database? Stuff on internal storage? If so, check the creation date of the file, which should be a rough approximation of when they first installed the app. – CommonsWare Jul 30 '12 at 23:51
  • I realized actually as I was posting this that I do modify the filesystem. I was just going to check for the existence of the folder, but creation date is even better. – MalcolmOcean Jul 31 '12 at 02:36

1 Answers1

0

No, you cannot detect the app version of a previously downloaded or initially downloaded APK. You can only detect the app version of the current app.

The only way I can think of for you to get around this would be to implement an update in which you have SharedPreferences, which sets something like "has_downloaded" = true. Once all the users have updated, you update, stop setting the "has_downloaded" variable, and check it instead. If it's true, it's one of your initial users, otherwise, show an ad.

This is far from a feasible solution, though, if you have a large userbase. I still have users using versions that are 2+ months old. Additionally, if they ever have to reinstall (or if they clear the app data), this data will be lost.

If your app had, previous to now, been saving data, you could check for the presence of this data, and in all future versions, save it under a different name. You still run into the reinstall issue with this method, though.

Cat
  • 66,919
  • 24
  • 133
  • 141
  • The micro-update idea is a good one. It feels weird to force an update on my users that doesn't do anything, but it could also allow me to basically reward the people who update promptly. The other issue is that I'm on a fairly short timeline. – MalcolmOcean Jul 31 '12 at 02:29
  • Yes, time is a bit of a factor. You may just have to hope the majority of your users update frequently. – Cat Jul 31 '12 at 03:15
  • Hm. Last time I updated (6 months ago) I had 60% updated within a week. That might be livable, especially since even now I'm only at 90%, meaning that many users who don't update within a week don't update for a long time, if at all. – MalcolmOcean Jul 31 '12 at 03:27