Zhi*_*pan 5 java android in-app-purchase in-app-billing google-play
我们有一个支持In App Billing v3的Android应用程序.在我们的测试中,其他一切工作正常,但我们发现通过查询库存也可以获得非活动产品.
这就是我们在应用商品库存中查询Google Play的方式:
ArrayList<String> moreSkus = new ArrayList<String>();
moreSkus.add("gas");
moreSkus.add("premium");
mHelper.queryInventoryAsync(true, moreSkus, mGotInventoryListener);
...
IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, final Inventory inventory) {
if(inventory.hasDetails("premium")) {
System.out.println("Inactive product is also visible to app!");
}
}
};
Run Code Online (Sandbox Code Playgroud)
在这两个产品中,"premium"处于非活动状态,但IabHelper.QueryInventoryFinishedListener中的print语句仍然执行!
有没有办法只获得有效产品?
AFAIK,您可以从查询列表中删除该 sku
//moreSkus.add("premium"); //don't query this item
Run Code Online (Sandbox Code Playgroud)
这取决于您的代码,但有点有意义,因为您无法使用空的“moreSku”列表查询所有可用产品,您必须选择您真正想要的;无论如何,这取决于你的代码。希望它能有所帮助。
| 归档时间: |
|
| 查看次数: |
698 次 |
| 最近记录: |