2

http://developer.android.com/guide/market/billing/billing_integrate.htmlにある Android のアプリ内課金のサンプル コードに従いました。

そのコードをアプリケーションに統合し、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");

どちらのダイアログも表示されません - すべてが市場請求サービスに正しくバインドされていることを示唆しています。

ただし、 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);
        }
    }

ログ メッセージは次のように表示されます。

サポート: false:null サポート: false:subs

Androidマーケットのコールバックが、アプリの請求標準でも、サブスクリプションが有効になっていないとも言われていないことを示唆しています....

誰かが最初のチェックが失敗しない理由を説明してもらえますか?

どうもありがとう

4

2 に答える 2

13

ここで私が使用したコードSimple InApp Billing / Paymentとあなたも使用することができます。

ここに画像の説明を入力してください

ここに画像の説明を入力してください

それが役に立てば幸い。

于 2012-06-20T11:57:35.033 に答える
0

リクエスト バンドルを作成するときに BILLING_REQUEST_API_VERSION を変更しましたか。以下の方法はサンプルプロジェクトからのものです

protected Bundle makeRequestBundle(String method) {
       Bundle request = new Bundle();
       request.putString(Consts.BILLING_REQUEST_METHOD, method);
       request.putInt(Consts.BILLING_REQUEST_API_VERSION, 2);
       request.putString(Consts.BILLING_REQUEST_PACKAGE_NAME, getPackageName());
       return request;
}
于 2012-07-27T10:50:00.233 に答える