Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getBuyIntent returns null API version 3 in-app billing

Tags:

java

android

I'm already checking for Internet connection and that Google Play market is installed with the latest package version.

Basically the Parable is failing because the buyIntent for in-app purchases is returning null after the first time it is used.

Here is the code and I suspect the error to be in this block (no where else)

I'm also getting this returned from the catch block but I'm not sure what it means, the package name is changed as I don't want my app to be shown.

Error: (Not from my package but system level)

[79] InAppBillingUtils.getPreferredAccount: com.mypackage.appname: Account from first account - [jbC6uT04zd8tXCrK]

Code:

Bundle buyIntentBundle = null;
        try 
        {
            buyIntentBundle = 
                    mServiceConnection.mBillingService.getBuyIntent(
                    3, 
                    mContext.getPackageName(), 
                    mPurchaseCodesAsStrings[PurchaseType], 
                    "inapp", 
                    mDeveloperPayload
                );
        } 
        catch (RemoteException e) 
        {
            e.printStackTrace();
        }

        PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
like image 967
Oliver Dixon Avatar asked Jun 26 '13 02:06

Oliver Dixon


1 Answers

You get this error if your using API version 3 and your trying to re-purchase a MANAGED in-app product. All products are MANAGED with version 3.

You've got to basically consume the MANAGED products that already exist before trying to purchase again.

like image 188
Oliver Dixon Avatar answered Nov 03 '22 06:11

Oliver Dixon