My application can buy an in-app product which I have configured on the google developer account.
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.
Here is a code extract:
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);
}
}
});
}
}
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.
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?
Thanks