0
votes

I have used Billing client to handle inapp purchase. Once a non-consumable product is purchased, after acknowledging I can save a value in shared preferences.

Constraints If the user clear the app data or uninstall the app, It will be lost. How to handle this scenario.

Note I am not convinced to save it in cloud. pls suggest how to fetch it from Google play each time the app starts using billing Client.

1

1 Answers

0
votes

You should call billingClient.queryPurchases() to get what items the user owns when the app is first started after installation.

Then you can save it in SharedPreferences but I recommend to call billingClient.queryPurchases() periodically to update the list. This is still more important if the item is a subscription to know if it is still active or has expired.

And do not forget to verify the signature of the data received to avoid fraud.