Precautions for android google purchases

Source: Internet
Author: User

Use google for in-house purchase on android machines

1. applications with the same bundle id, that is, com. android. game and so on, because this bundle id is the only identifier of google play that identifies the differences between applications, if you want to add, it is also possible, but google play only recognizes the first to add, including the internal purchase project is also the application that directly connects to the first application that adds the same bundle id, even if other android applications use other keystore, but still cannot be changed, will connect to the first application with the same bundle id as a matter of fact, it is very likely that an in-house purchase project has been added but the document cannot be found. Therefore, ensure that only one bundle id is uploaded.

 

2. Note that the google play version must be 3.5 or above and must be non-China-specific google play. Currently, google play is tested in the US region. store, please open the VPN connection to the server in the United States, then force close google play, and then clear the google play cache and re-open google play

 

3. When you update an application version, ensure that the same bundle id, bundle version, and version code are higher than the current version.

 

 

4. in google's official java example, there is a BUG of repeated purchases, that is, two results will be returned after one click, one is generally returned without this document, the other is normal return, and the BUG here actually exists. the cause is that the Code for button response in the main java document has an error, the official code has been judged twice, whether it is an internal purchase type, and whether it is a subscription type. Actually, the subscription type is not when judgment is executed, an error without this document is always displayed. The solution is to add judgment to the subscription type.

Original BUG code:

if (mManagedType != Managed.SUBSCRIPTION &&                    !mBillingService.requestPurchase(mSku, Consts.ITEM_TYPE_INAPP, mPayloadContents)) {                showDialog(DIALOG_BILLING_NOT_SUPPORTED_ID);            } else if (!mBillingService.requestPurchase(mSku, Consts.ITEM_TYPE_SUBSCRIPTION, mPayloadContents)) {                // Note: mManagedType == Managed.SUBSCRIPTION                showDialog(DIALOG_SUBSCRIPTIONS_NOT_SUPPORTED_ID);            }

Modified code

if (mManagedType != Managed.SUBSCRIPTION &&                    !mBillingService.requestPurchase(mSku, Consts.ITEM_TYPE_INAPP, mPayloadContents)) {                showDialog(DIALOG_BILLING_NOT_SUPPORTED_ID);            } else if (mManagedType == Managed.SUBSCRIPTION && !mBillingService.requestPurchase(mSku, Consts.ITEM_TYPE_SUBSCRIPTION, mPayloadContents)) {                // Note: mManagedType == Managed.SUBSCRIPTION                showDialog(DIALOG_SUBSCRIPTIONS_NOT_SUPPORTED_ID);            }

It is obvious that an mManagedType = Managed. SUBCRIPTION is added to the condition judgment after else if. if it is not the subscription type, the subsequent code is no longer executed.

Documentation address: http://stackoverflow.com/questions/10775008/in-app-billing-item-not-found

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.