如何在没有打开购买对话框的情况下在我的Android应用程序中验证用户已完成购买? [英] How can I verify user has already done in purchase In my Android App without open Purchase Dialog?

查看:127
本文介绍了如何在没有打开购买对话框的情况下在我的Android应用程序中验证用户已完成购买?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,我已经在用户打开应用程序时进行了应用程序购买我在第一次购买时检查是否发生使用 launchPurchaseFlow(使用自动调用)因为这个打开的对话框在应用程序中购买(我称之为第一次使用此方法,因为假设用户已经在应用程序购买中重新安装了应用程序,因此检查购买是否发生此方法已经购买,因此我可以知道不显示添加)所以我怎么称之为这种方法并在第一次忽略购买对话框?我在 launchPurchaseFlow 方法中做了什么改变 IabHelper.java 提前谢谢....

I have one application in that i have put In App Purchase when User open Application i check first time In Purchase happen or not using launchPurchaseFlow(using automatic call) because of this open Dialog of In App purchase(i am call this methode first time because suppose user have done in app purchase he is reinstalling App so check in Purchase happen or not this methode give response Already Purchase so i can know not to display add ) so how can i call this methode and ignore the in purchase dialog first time ? what change i do in launchPurchaseFlow methode of IabHelper.java Thanks in Advance....

推荐答案

您应该查询购买商品而不是launchPurchaseFlow。

You should query for purchased items instead of launchPurchaseFlow.


要检索用户从您的应用购买的信息,请拨打
应用内结算版本3服务中的getPurchases方法。
传入应用内结算API版本(3),您的通话应用的
套餐名称以及购买类型(inapp或
subs)的方法)。

To retrieve information about purchases made by a user from your app, call the getPurchases method on the In-app Billing Version 3 service. Pass in to the method the In-app Billing API version ("3"), the package name of your calling app, and the purchase type ("inapp" or "subs").



Bundle ownedItems = mService.getPurchases(3, getPackageName(),
"inapp", null); 




Google Play服务仅返回购买
当前登录到设备的用户帐户。

The Google Play service returns only the purchases made by the user account that is currently logged in to the device.

要查询活动订阅,请使用getPurchases方法,再次使用产品类型参数设置为
subs。

To query for active subscriptions, use the getPurchases method, again with the product type parameter set to "subs".



Bundle activeSubs = mService.getPurchases(3, "com.example.myapp",
                   "subs", continueToken);

这篇关于如何在没有打开购买对话框的情况下在我的Android应用程序中验证用户已完成购买?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆