• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How to use getPurchases() - Android

MSP3

Lurker
1
I have successfully implemented In-App-Billing into my app. The IAP is working successfully and I have tested it to make sure its working.

When a user clicks on a button, they have to make an IAP to proceed. However, everytime a user clicks on the button it starts the IAP, even though they have already made the IAP. I want my IAP to be non-consumable obviously. Currently, I'm storing the IAP in SharedPreferences, but if the user reinstalls the app, they lose their IAP.

So how can I use getPurchases() or restoreTransactions() on my onCreate or onClick method to check whether the user has purchases a specific item? I have searched all over the Internet and read through so many samples and it doesn't seem to work, perhaps I am misunderstanding though.

If you need me to post any code, please ask and I'll update my post.
 
but if the user reinstalls the app, they lose their IAP.

If you're storing a record of the user's IAP locally on the device, then a reinstall of the app will completely destroy that data. If you want to retain a permanent record of purchases in this situation, then you'll have to use a remote database to do that.
 
Hi, thank you for your response. I understand what you're saying thank you. So, perhaps I could use Firebase to store that information
 
Back
Top Bottom