Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>According to <a href="http://developer.android.com/guide/google/play/billing/billing_integrate.html" rel="nofollow">the billing integration guide</a>: </p> <blockquote> <p>when the requested transaction changes state (for example, the purchase is successfully charged to a credit card or the user cancels the purchase), the Google Play application sends an IN_APP_NOTIFY broadcast intent. This message contains a notification ID, which you can use to retrieve the transaction details for the REQUEST_PURCHASE request.</p> </blockquote> <p>And the intent <code>com.android.vending.billing.PURCHASE_STATE_CHANGED</code> contains <code>purchaseState</code></p> <blockquote> <p>The purchase state of the order. Possible values are 0 (purchased), 1 (canceled), 2 (refunded), or 3 (expired, for subscription purchases only).</p> </blockquote> <p><a href="http://developer.android.com/guide/google/play/billing/billing_reference.html#billing-interface" rel="nofollow">source</a> (table 4)</p> <hr> <p>EDIT: In the dungeons sample, there is an inner class extending <code>PurchaseObserver</code> (see <code>Dungeons</code> activity) that does the job, see especially (<code>onPurchaseStateChange</code>)</p> <hr> <p>EDIT2: some pseudo-code</p> <p>in the activity (<code>Dungeons</code> class in the sdk sample):</p> <pre><code>Button buy = (Button)findViewById(R.id.buy); buy.setEnabled(false); buy.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // show purchase dialog and call mBillingService.requestPurchase() on dialog validation } }); // request to see if supported if (!mBillingService.checkBillingSupported()) { // not supported } </code></pre> <p>in the observer (<code>DungeonsPurchaseObserver</code> in the sample):</p> <pre><code>public void onBillingSupported(boolean supported, String type) { if (type == null || type.equals(Consts.ITEM_TYPE_INAPP)) { if (supported) { // billing supported: enable buy button } else { // billing not supported: disable buy button } } } public void onPurchaseStateChange(PurchaseState purchaseState, String itemId, int quantity, long purchaseTime, String developerPayload) { if (purchaseState == PurchaseState.PURCHASED) { // item purchased } else if (purchaseState == PurchaseState.CANCELED) { // purchase canceled } else if (purchaseState == PurchaseState.REFUND) { // user ask for a refund } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload