how to identify the products purchased in android?

I’m finishing my game that will use In-app and I need to know what products the user has purchased to start the session

I have missed something really obvious…how I can capture that information from Google play?

Regards!!

store.restore()

thank you very much Rob!!!

It`s posible to reset a user purchases on google?? It’s just for testing …

I don’t believe so.  Google gives you a product that always returns success for you to test multiple things on:  android.test.purchased

buying that code will always return successful.

thank you very much rob.

I’m developing it and I have a new question. If you do not want to force the user to have to always connect to the internet to play (get information of products purchased from google play) do I need to record the products purchased in my app? Do I need to insert records in a database?

I would save some local variable showing that the app is unlocked.  The only problem you would run into is if they delete the app, re-install it from syncing somehow without being online.  Then you wouldn’t know if you have purchases or not.

sorry rob but I dont understand. How  I would save local variable?? I need update it with each purchased and its updated each time they enter without internet

App starts.

Load’s saved file

isPurchasedItem in saved file?  Yes, Unlock item.

store.restore()

if call back happens, if purchase unlocks, unlock the item, save that it’s unlocked locally.

If call back doesn’t happen you now know have a flag that indicates if it’s unlocked or not.

And it is not possible to update the APK and not have an external file? … Thank you very much for your help Rob!

No, you cannot update the binary for a mobile app after it’s been signed and delivered by the store.  External data files are easy to do and its where you keep your unique per-customer data if you don’t want to use an online database for it.

thank you very much rob. It is very important for beginners to know which way is right. I’ve seen other applications have their external files.

Any suggestions on encryption? or directory where I can store it? I used system.documentsDirectory

Regards

system.DocumentsDirectory would be the proper place to save this data.  We have our own crypto.* library that you can use for encryption.

store.restore()

thank you very much Rob!!!

It`s posible to reset a user purchases on google?? It’s just for testing …

I don’t believe so.  Google gives you a product that always returns success for you to test multiple things on:  android.test.purchased

buying that code will always return successful.

thank you very much rob.

I’m developing it and I have a new question. If you do not want to force the user to have to always connect to the internet to play (get information of products purchased from google play) do I need to record the products purchased in my app? Do I need to insert records in a database?

I would save some local variable showing that the app is unlocked.  The only problem you would run into is if they delete the app, re-install it from syncing somehow without being online.  Then you wouldn’t know if you have purchases or not.

sorry rob but I dont understand. How  I would save local variable?? I need update it with each purchased and its updated each time they enter without internet

App starts.

Load’s saved file

isPurchasedItem in saved file?  Yes, Unlock item.

store.restore()

if call back happens, if purchase unlocks, unlock the item, save that it’s unlocked locally.

If call back doesn’t happen you now know have a flag that indicates if it’s unlocked or not.

And it is not possible to update the APK and not have an external file? … Thank you very much for your help Rob!