In app billing issue

可紊 提交于 2019-12-20 02:57:11

问题


I am trying to implement in app purchasing and have had problems for days. When a user attempts to make a purchase it is successful but the app is giving an odd error that apparently dates back to os build honeycomb which prevents users from receiving the purchase until they click the buy button again.

Steps:

Make purchase

Purchase successful

No consumable given

Click purchase button again

Consumable given

Here is the error I am getting when the consumable isn't given:

Log Tag: Finsky

Log Message [1] 1.run: missing delivery data for inapp:com.mybillingproblem:one_chip

PID/TID: 26927

Code:

public void oneChip(String noVal) {
    Log.v("oneChip", "Calling launch purchase flow");
    bp.purchase(this, itemOne);
    Log.v("oneChip", "made it through launch purchase flow");
}

    bp = new BillingProcessor(this, base64EncodedPublicKey,
            new BillingProcessor.IBillingHandler() {

                @Override
                public void onBillingInitialized() {
                    Log.v("chip", "billing initialized");
                    readyToPurchase = true;
                }

                @Override
                public void onProductPurchased(String productId,
                        TransactionDetails details) {
                    Log.v("chip", productId + " purchased");
                    if (bp.consumePurchase(productId)) {
                        if (productId == "itemOne"
                                || productId == "one_chip")
                            ChipUpdate.updateChipCount(2500);
                    }
                }

                @Override
                public void onBillingError(int errorCode, Throwable error) {
                    Log.v("chip", "Error code: " + errorCode);
                    Log.v("chip", "Error: " + error);
                }

                @Override
                public void onPurchaseHistoryRestored() {
                    for (String sku : bp.listOwnedProducts())
                        Log.v("chip", "Owned Managed Product: " + sku);
                    for (String sku : bp.listOwnedSubscriptions())
                        Log.v("chip", "Owned Subscription: " + sku);
                }

            });

Note: I am using the in app billing v3 jar. I don't think this is the issue though as it has come recommended and seems to be a commonly used wrapper.

Thanks!


回答1:


How does your Activity's onActivityResult() look like? Do you have one? Usually you pass the the result to to IabHelper's handleActivityResult

like so:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
    // Pass on the activity result to the iab helper for handling
    if (!mHelper.handleActivityResult(requestCode, resultCode, data))
    {
      // not handled, so handle it ourselves (here's where you'd
      // perform any handling of activity results not related to in-app
      // billing...
      super.onActivityResult(requestCode, resultCode, data);
    }
}


来源:https://stackoverflow.com/questions/29906980/in-app-billing-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!