
Posted by Oscar Rodriguez, Developer Advocate
to display dialogs that allow your users to complete their purchase.
While there is , the general flow is as follows:
- Call the
method to deliver the result of the purchase operation.
- If your app has a server, we strongly recommend that you .
- Acknowledge the purchase either with
for non-consumable items.
- Finally, grant entitlement to the purchased item inside the app.
If your app is still using the as soon as possible.
If you are using the AIDL API, or to launch the Google Play purchase dialog.
Intent to your onActivityResult() method, where you can verify if the purchase was successful. method to make the item available for purchase again.
Nevertheless, just implementing the above mentioned flow is not enough to correctly handle all types of purchases. There are two main cases in which purchases will not be correctly handled by this flow.
The first case happens when the purchase flow is interrupted before it finishes. The app may have crashed, the user may have killed the app, or the user’s Internet connection may have been lost. In any case, it is possible for the app not to have delivered the item to the user even though Google Play has already processed the payment. In this case, the item is in limbo, because Google Play will not allow an item to be re-purchased until it is consumed, but the app or game won’t consume the item outside of the flow mentioned above.
The second case happens during alternative purchase flows, such as , callback, call the by using the for consumable items or with callback, call the by using the method to make the item available for purchase again.
In either case, when you detect and process an unconsumed item in this manner, users will expect the app or game to communicate about it. We suggest that you display a dialog, message box, or notification that tells the user that they have successfully received their item.
Keep in mind that your app’s called from any of those screens. For an optimal user experience, we suggest you make it so your app or game handles unacknowledged or unconsumed items regardless of the screen you display when .
To support this scenario with the Google Play Billing Library, do the following:
- Google Play calls the
by using thefor consumable items or withcallback, register acallback, unregister the listener.
- If your app has a server, we strongly recommend that you .
- Google Play calls your listener to notify your app that there is a new pending item. Inside it, call the
method to make the item available for purchase again.
- Finally, grant entitlement to the purchased item inside the app.
Just as before, you should display a dialog, message box, or notification that tells the user that they have successfully received their item.
If you follow these steps, your app or game will be better prepared to robustly handle purchase flow interruptions and alternative purchase flows.
SOCIAL SHARE CARD GENERATOR