我正在测试我的Android应用程序,并面对“无法购买的项目(回复:7:项目已经拥有)”。该项目是“托管应用程序中的产品”类型。我做了一些研究,发现这个(http://developer.android.com/google/play/billing/api.html#managed):
Managed in-app products are items that have their ownership information tracked and managed
by Google Play. When a user purchases a managed in-app item, Google Play stores the
purchase information for each item on a per-user basis. This enables you to later query
Google Play at any time to restore the state of the items a specific user has purchased.
This information is persistent on the Google Play servers even if the user uninstalls the
application or if they change devices.
If you are using the Version 3 API, you can also consume managed items within your
application. You would typically implement consumption for items that can be purchased
multiple times (such as in-game currency, fuel, or magic spells). Once purchased, a managed
item cannot be purchased again until you consume the item, by sending a consumption request
to Google Play. To learn more about in-app product consumption, see Consuming Items.
...
You can use the consumption mechanism to track the user's ownership of in-app products.
In Version 3, all in-app products are managed. This means that the user's ownership of all
in-app item purchases is maintained by Google Play, and your application can query the
user's purchase information when needed. When the user successfully purchases an in-app
product, that purchase is recorded in Google Play. Once an in-app product is purchased, it
is considered to be "owned". In-app products in the "owned" state cannot be purchased from
Google Play. You must send a consumption request for the "owned" in-app product before
Google Play makes it available for purchase again. Consuming the in-app product reverts it
to the "unowned" state, and discards the previous purchase data.我怎样才能在代号为“发送消费请求”?
发布于 2016-02-17 08:49:42
假设你使用的是谷歌在安卓SDK中提供的IabHelper.java。以下是这条道路:
Android_SDK\sdk\extras\google\play_billing\samples\TrivialDrive\src\com\example\android\trivialdrivesample\util下面是初始化应用程序计费、查询google播放的用户购买和消费的代码。
发布于 2016-02-17 15:40:37
使用
Purchase.getInAppPurchase().wasPurchased(String sku)如果该项目是托管项目,并且已经购买,它将返回true。
https://stackoverflow.com/questions/35449142
复制相似问题