Reputation: 4259
I have an app on the market that costs $0.99. I want to implement in-app billing so that I can offer it for free with an option to unlock certain features for a price. I've already modified the code to allow that. Question is... how might I mark the 1000+ people who already purchased the app as having purchased it and unlock all the features?
Upvotes: 6
Views: 294
Reputation: 22342
You might be able to hack your way around this if you're using some sort of persistent storage.
For SharedPreferences, on the first run, do a check for one of your preferences using SharedPreferences.contains()
. If it contains it, the app must have already been installed. If not, set another preference that marks the user as new(free), and set yet one more so it doesn't do the check every time.
That might only work if the preference doesn't have a "default" value, I'm not entirely sure if setting a default in xml will mark it as contained.
You could do something similar if you have any assets that get transferred to SD, or any similar one-time setup. Just check to see if it's already done before doing it the first time.
If you're using an SQLite DB, you could increment the DB version and mark as "paid" in onUpgrade()
if coming from the current version(or earlier).
Like I said, it's a hack, but I don't know of any "official" way to check to see an app install is an upgrade or an initial install. There are some pitfalls here, though. For instance, if a previous paid customer completely uninstalls before installing the new version, or if it's on a new device...
Upvotes: 3