如何检查是否已购买应用程序-CodenameOne [英] How to check if an app has already been purchased - CodenameOne
问题描述
我的应用程序可以购买我在google开发人员帐户上配置的应用程序内产品。
My application can buy an in-app product which I have configured on the google developer account.
该产品是一次性购买的产品。我想知道如何检查该物品是否已经购买(在codenameone中)并根据查询结果进行处理。
The product is a buy-once product. I would like to know how to check if this item has already been bought (in codenameone) and handle it based on result of query.
以下是代码摘录:
if(p.isManagedPaymentSupported()) {
if(p.wasPurchased(id)){
boolUpdate = true;
Form f = (Form)createContainer(resPath,"Search");
beforeSearch(f);
f.show();
}else{
Display.getInstance().callSerially(new Runnable() {
public void run() {
Boolean confirmAction = Dialog.show("Buy Product?","","Yes","No");
if(confirmAction){
p.purchase(id);
}
}
});
}
}
根据codenameone API文档, p。 wasPurchased(id)方法应该提供此功能。但是在我的设备上安装并购买后,情况并非如此。购买产品后,付款过程将再次开始。
According to the codenameone API doc, The "p.wasPurchased(id)" method is supposed to provide this functionality. But this is not the case after installing on my device and making a purchase. The payment process begins again even after the product has been bought. Meaning the "wasPurchased()" check is returning false.
我想检查商品是否已经购买,并根据该商品转到下一个屏幕,或者开始购买过程。请问我如何在codenameone上实现它?
I would like to check if the item is already purchased and based on that either go to the next screen, or begin the purchase process. Please how can I implement this on codenameone?
谢谢
推荐答案
当前假设Android是不支持您目前所管理的购买平台吗?
Currently managed purchases aren't supported on Android which I'm assuming is the platform you are referring to?
有RFE和一些代码可以解决该问题,但我们没有撰写本文时,请尽量避免这样做: http:// code .google.com / p / codenameone / issues / detail?id = 731
There is an RFE and some code to resolve it but we didn't get around to do it as of this writing: http://code.google.com/p/codenameone/issues/detail?id=731
这篇关于如何检查是否已购买应用程序-CodenameOne的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!