Few days before i have posted in google+ about android in app purchase. The discussion is totally interesting. Here is the link for google+ post https://plus.google.com/+ahesanalisuthar/posts/HckTGcAw8Gn

Here is text of post i have extracted.

Question:
I would like to integrate in-app purchases in my app.

But i have few questions.

  1. If app user successfully purchase item how can i activate feature? Does another apk will be downloaded from playstore? Does google play developer console manages these?

  2. If i have to manage in same app which is installed Should i use some persistance mechanism like database or shared preferences after user successfully made purchase? If yes than my most important question is , if user uninstall app or clear data from settings, how that purchase will be restored? Does user have to re-purchase that feature again?

Comments:

  1. After purchase you will obtain some response with product id. Then you can activate your feature – this is your responsibility.
    You can save info about the purchase and use it in the app.
    Also there is an API which allows to check if some product has been purchased. You can check this at the start-up of the app or have special option for do this. Anyway you should have this, because the store will not allow the user to buy the same product.
    This is true if product is not consumable (i.e. not like extra money in the game).
    Also take into account that there are can be following cases which can be handled if you check that the product has been purchased:
  • User redeem the product via promocode.
  • User buy the product on one device, but uses multiple devices (in this case the user think that the feature will be available on all devices).
  1. Using in-app billing API v3, your app calls getPurchases() to retrieve the features the user has purchased.
    https://developer.android.com/google/play/billing/billing_integrate.html#QueryPurchases

They are stored on the Google Play server so if the app is reinstalled the user will get his purchases back.

Purchases are cached locally on the device so you don’t need to manage your own database of purchased items if you don’t want to.
https://developer.android.com/google/play/billing/api.html#caching
3. +Christophe Beyls (https://plus.google.com/116805029264699613929) thanks, but how can i activate feature ?
Before user purchase feature how can i check that user has not yet made purchase so that let app disable that feature.
4. You disable the feature by default and only enable it when it is returned in the list returned by getPurchases().
5. Play store should cache the value, but it happens several times that is not true or the caching period is really too low, so yes, you need to have some backup because for example the device has no connectivity.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s