Question

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

Was it helpful?

Solution

Currently managed purchases aren't supported on Android which I'm assuming is the platform you are referring to?

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top