Android应用内结算声称不支持使用示例代码

Ren*_*ndy 2 android android-service in-app-billing

我已经按照Android应用程序计费的示例代码进行了访问:http://developer.android.com/guide/market/billing/billing_integrate.html

我已将该代码集成到我的应用程序中 - 并遵循所有步骤,包括签署apk - 上传,在应用程序产品列表中创建等.

出于某种原因,当我的应用程序在onCreate方法中的这些行时:

 Log.e("sc2","About to check if billing is supported");
    // Check if billing is supported.
    ResponseHandler.register(mDungeonsPurchaseObserver);
    if (!mBillingService.checkBillingSupported()) {
    Log.e("sc2","failed check for billing supported");
        showDialog(DIALOG_CANNOT_CONNECT_ID);
    }

    if (!mBillingService.checkBillingSupported(Consts.ITEM_TYPE_SUBSCRIPTION)) {
         Log.e("sc2","failed check for billing supported subscriptions");
        showDialog(DIALOG_SUBSCRIPTIONS_NOT_SUPPORTED_ID);
    }
    Log.e("sc2","Finished checking if billing is supported");
Run Code Online (Sandbox Code Playgroud)

两个对话框都没有显示 - 表明所有内容都与市场结算服务绑定正确.

但是在PurchaseObserver回调这些行:

 private class SC2PurchaseObserver extends PurchaseObserver {
    public SC2PurchaseObserver(Handler handler) {
        super(UpgradesActivity.this, handler);
    }

    @Override
    public void onBillingSupported(boolean supported, String type) {
        if (Consts.DEBUG) {
            Log.e("sc2", "supported: " + supported+":"+type);
        }
        if (type == null || type.equals(Consts.ITEM_TYPE_INAPP)) {
            if (supported) {
                restoreDatabase();
                mBuyButton.setEnabled(true);
                mEditPayloadButton.setEnabled(true);
            } else {
                showDialog(DIALOG_BILLING_NOT_SUPPORTED_ID);
            }
        } else if (type.equals(Consts.ITEM_TYPE_SUBSCRIPTION)) {
            mCatalogAdapter.setSubscriptionsSupported(supported);
        } else {
            showDialog(DIALOG_SUBSCRIPTIONS_NOT_SUPPORTED_ID);
        }
    }
Run Code Online (Sandbox Code Playgroud)

日志消息显示如下:

supported:false:null supported:false:subs

建议Android市场回调既没有说应用计费标准,也没有启用订阅....

有人可以解释为什么第一次检查可能没有失败 - 但回叫消息显示为他们!?

非常感谢

Str*_*der 13

这里我用的代码Simple InApp Billing / Payment,你也可以使用.

在此输入图像描述

在此输入图像描述

希望能帮助到你.

  • 如果您需要https://github.com/robotmedia/AndroidBillingLibrary,请使用此选项 (3认同)