In App Billing (Android)

Aus Byte-Welt Wiki
Version vom 19. September 2019, 12:24 Uhr von L-ectron-X (Diskussion | Beiträge)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springenZur Suche springen

http://developer.android.com/guide/google/play/billing/billing_integrate.html

Das Beispiel von Google beinhaltet einen Bug in der Dungeons.java

    @Override
    public void onClick(View v) {
        if (v == mBuyButton) {
            if (Consts.DEBUG) {
                Log.d(TAG, "buying: " + mItemName + " sku: " + mSku);
            }

            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);
            }
        } else if (v == mEditPayloadButton) {
            showPayloadEditDialog();
        } else if (v == mEditSubscriptionsButton) {
            editSubscriptions();
        }
    }

ersetzen durch

  @Override
    public void onClick(View v)
    {
        if (v == mBuyButton)
        {
            if (Consts.DEBUG)
            {
                Log.d(TAG, "buying: " + mItemName + " sku: " + mSku);
            }

            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);
            }
        }
        else if (v == mEditPayloadButton)
        {
            showPayloadEditDialog();
        }
        else if (v == mEditSubscriptionsButton)
        {
            editSubscriptions();
        }
    }