I will say that going that route may get your app rejected. Apple has been known to reject apps that offer in-app purchases but do not have a “Restore purchases” button.
On Google you can call store.restore() after starting up and you will get a series of purchases of your managed products. You can use these purchase events to unlock things you need to unlock.
Apple prompts for a username/password for the App Store when store.restore() is called. They don’t want users to have to login to use your app and you must defer restore calls until the users desires to restore them.
Rob
Thanks for the reply Rob, but that is the opposite of what’s being asked. We don’t want a response when a user already purchased something, we want a response when the user hasn’t purchased anything yet.
If I do what you say I have to make the user wait before giving up and not try to unlock the app. This timeout solution isn’t acceptable. During this time the app is in limbo waiting for something that may or may not happen. Do I show a message “trying to restore your previous purchase” and wait 30 seconds every single time a user starts the app? If I do it in the background and not show any message, the user can still go to the Upgrade section and click to purchase it again, which is sure to mess things up even further. Or they can exit the app and call support enraged that the app they previously purchased is unlocked without giving enough time for the restore process to go through. Even if the reponse is fast but the user already entered the main screen of my app I can’t just make stuff unlocked like that. It requires re-entering the main screen, so in this case I would have to kick the user out of that screen and reload it with the new features. Not very nice.
You can implement this feature on your side easily if you really want to, by using the getPurchases() Java method since that does return empty if there are no purchases or a list of the user’s purchases otherwise.
If you save the purchases so that on reset you automatically unlock things, the user shouldn’t need to go through a restore process. Restore is for people who have removed the app and need to restore their settings.
For those in this state, calling restore silently at the beginning should process the purchases rather quickly and there is a good chance it will be done before they can get go that purchasing screen.
Rob
The restore process in my case is precisely for “people who have removed the app and need to restore their settings”. I’ll try your suggestion, but I don’t know why you guys aren’t even considering adding what is being asked here since it would make our life much easier and it is now possible to offer that functionality on both platforms, so your previous excuse of “keeping consistency” isn’t valid anymore.
If this is important to you, I would recommend filing a feature request at http://feedback.coronalabs.com and get people to vote it up. I know many people are frustrated at the lack of a call back when there is nothing to restore, but my understanding is that’s a feature of the SDK’s driving the store.* code. Apple insists that you provide a restore button. That same logic works just fine for Google too if you want to provide UI consistency.
Rob