Is it okay to store user in-app purchases in SharedPreferences? Moreover will SharedPreferences (which are saved to user's Google account, if I'm not wrong) will be the same for the app among all user's devices, which use same Google account?
No, you shouldn't. If the user deletes the app data via the settings, this will also delete the SharedPreferences.
Use the API, to query the in-app purchases from the user, which is documented here.
Julian is right, you should always query for the purchases, in onResume() for example.
If you did want to store the product id or part of the receipt in SharedPrefs just make sure to use Context.MODE_PRIVATE and I wouldn't store anything like purchaseToken or orderId.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With