Created
August 13, 2012 20:59
-
-
Save joshdholtz/3344056 to your computer and use it in GitHub Desktop.
Android: In App Billing Sample Fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Called when a button is pressed. | |
| */ | |
| @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 (!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(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Called when a button is pressed. | |
| */ | |
| @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(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment