1

ダンジョンの例を参照して、アプリ内の製品にInapp課金を実装し、そこから実装しています!! しかし、今はアプリケーションにチェックアウトダイアログボックスを表示しようとしておらず、logcatにもエラーが表示されません。アプリケーションは、接続メッセージがないダイアログボックスに結果をエラーとして表示します。

ログを使用して問題を追跡しています。チェックアウトダイアログボックスを表示するために使用しているコードは、メインクラス内にあります::::::::::

 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Intent j = getIntent();
    int position = j.getExtras().getInt("BId");
    System.err.println("Bid="+position);
    Log.i("J","gf");


    mHandler = new Handler();
    mBooksPurchaseObserver = new BooksPurchaseObserver(mHandler);
    mBillingService = new BillingService();
    mBillingService.setContext(this);
    mItemName = getString(CATALOG[position].nameId);
    mSku = CATALOG[position].sku;
    System.err.println("mSku_______="+mSku);
    System.err.println("mItemName____="+mItemName);
    System.err.println("Consts.DEBUG=="+Consts.DEBUG);
    ResponseHandler.register(mBooksPurchaseObserver);
    if (mBillingService.checkBillingSupported()) {
        Log.i("ds","bsc_checkconnection");


    }
    if (Consts.DEBUG!=true) {
        Log.d(TAG, "buying: " + mItemName + " sku: " + mSku);
        Log.i("x","x");

    }
    mPurchaseDatabase = new PurchaseDatabase(this);

    if(!mBillingService.requestPurchase(mItemName, mSku)){

        Log.e("this is exp","request purchase______________");
        showDialog(DIALOG_BILLING_NOT_SUPPORTED_ID);
    }

    setupWidgets(); 
    Log.i("ga","Request purchaseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
    // Check if billing is supported.

    Log.i("ga","Request purchaseeeeeeeeeee");
}

請求サービスクラス::::

class RequestPurchase extends BillingRequest {
    public final String mProductId;
    public final String mDeveloperPayload;

    public RequestPurchase(String itemId) {
        this(itemId, null);
        Log.i("ga","Request purchase");


    }

    public RequestPurchase(String itemId, String developerPayload) {
        // This object is never created as a side effect of starting this
        // service so we pass -1 as the startId to indicate that we should
        // not stop this service after executing this request.

        super(-1);
        System.err.println("itemId="+itemId);
        Log.i("fads","request only");
        mProductId = itemId;
        mDeveloperPayload = developerPayload;
    }

    @Override
    protected long run() throws RemoteException {
        Log.i("gaaaaaaaaa","Request purchase");
        Bundle request = makeRequestBundle("REQUEST_PURCHASE");
        request.putString(Consts.BILLING_REQUEST_ITEM_ID, mProductId);
        // Note that the developer payload is optional.
        if (mDeveloperPayload != null) {
            request.putString(Consts.BILLING_REQUEST_DEVELOPER_PAYLOAD, mDeveloperPayload);
        }
        System.err.println("mService===="+mService);
        Bundle response = mService.sendBillingRequest(request);
        System.err.println("response__"+response);
        System.err.println("response__!!!!!!!!!!!!"+Consts.BILLING_RESPONSE_PURCHASE_INTENT);
        PendingIntent pendingIntent
                = response.getParcelable(Consts.BILLING_RESPONSE_PURCHASE_INTENT);
        System.err.println("Pending Intent==="+pendingIntent);
        Log.i("12","12");
        if (pendingIntent == null) {
            Log.e(TAG, "Error with requestPurchase");
            return Consts.BILLING_RESPONSE_INVALID_REQUEST_ID;
        }
        Log.i("2","2");
        Intent intent = new Intent();
        Log.i("222222","11111");
        System.err.println("Intent is equals to__"+intent);
        System.err.println("pendingIntent is equals to__"+pendingIntent);
     //   System.err.printf("fsd",ResponseHandler.buyPageIntentResponse(pendingIntent, intent));
        ResponseHandler.buyPageIntentResponse(pendingIntent, intent);
        Log.i("f","fdas");
        return response.getLong(Consts.BILLING_RESPONSE_REQUEST_ID,
                Consts.BILLING_RESPONSE_INVALID_REQUEST_ID);

    }

    @Override
    protected void responseCodeReceived(ResponseCode responseCode) {
        Log.i("response code","response code");
        ResponseHandler.responseCodeReceived(BillingService.this, this, responseCode);
    }
}

私のCheckbillingSupportingクラス

 class CheckBillingSupported extends BillingRequest {
    public CheckBillingSupported() {
        // This object is never created as a side effect of starting this
        // service so we pass -1 as the startId to indicate that we should
        // not stop this service after executing this request.
        super(-1);
    }

    @Override
    protected long run() throws RemoteException {
        Bundle request = makeRequestBundle("CHECK_BILLING_SUPPORTED");
        Bundle response = mService.sendBillingRequest(request);
        System.err.println("response code____"+Consts.BILLING_RESPONSE_RESPONSE_CODE);
        int responseCode = response.containsKey(Consts.BILLING_RESPONSE_RESPONSE_CODE)
                           ? response.getInt(Consts.BILLING_RESPONSE_RESPONSE_CODE)
                           : ResponseCode.RESULT_BILLING_UNAVAILABLE.ordinal();
        if (Consts.DEBUG) {
            Log.i(TAG, "CheckBillingSupported response code: " +
                    ResponseCode.valueOf(responseCode));
        }
        boolean billingSupported = (responseCode == ResponseCode.RESULT_OK.ordinal());
        ResponseHandler.checkBillingSupportedResponse(billingSupported);
        return Consts.BILLING_RESPONSE_INVALID_REQUEST_ID;
    }
}

誰かが私が間違っていたと私に言うことができますか?

4

0 に答える 0