Android In-App Billing list of available products

百般思念 提交于 2019-12-05 03:23:00

Third-paty apis and services are not reliable. There is no reliable and convenient way for production yet. You have to store it on your server in encrypted json data file for example, without any php/java/something, just static file.

OR you can guess item skus in your code and check even non-existing items: myitem_00-myitem_99 for example.

Jamie Cockburn

As mentioned in this post, this is now possible using the Google Play Developer API (a.k.a. android-publisher):

https://developers.google.com/android-publisher/

In particular, the Inappproducts: list API:

List all the in-app products for an Android app, both subscriptions and managed in-app products.

You can try this Google Play Store Api, or you can also look into this Android Market API.

But both of these are unofficial.

You have to do below things.

  • establish the connection between your app and google play app.
  • Get the list of products which is register in your google console.
  • prapare arraylist that contains product's id name and put into Bundle
  • code to get purchase
    ArrayList<String> skuList = new ArrayList<String> (); skuList.add("premiumUpgrade"); skuList.add("gas"); Bundle querySkus = new Bundle(); querySkus.putStringArrayList(“ITEM_ID_LIST”, skuList);

    • finaly one methode is reday in google_play_app that we need to call
  • Bundle skuDetails = mService.getSkuDetails(3, getPackageName(), "inapp", querySkus);

  • call the getSkuDetails method on the In-app Billing Version 3 API, and pass the method the In-app Billing API version (“3”), the package name of your calling app, the purchase type (“inapp”), and the Bundle is our response

  • extract the bundle and get the product names and display it in ativity.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!