Last week, we presented a webinar about How to Add In-App Purchasing and Subscriptions to your Android Apps. We demonstrated how easy it is to use the Amazon IAP and Subscription API in order to offer subscriptions and digital content in your Android Apps.
For those of you who were able to join us, thanks for tuning in! If you couldn’t attend, here’s a selection of the top questions we received:
Q: I'm not sure I fully understood the fulfillment notification. Why would you not grant the user his purchased IAP at the time the notification is received and instead wait until the purchase update event?
The reason we actually grant the user during onPurchaseUpdate() callback is the fact that the user might have purchased this in a previous session or even on a different device where he/she is logged in with the same Amazon account. onPurchaseUpdate() is invoked subsequently to any time onPurchase() is invoked, but needs to be invoked any time we need to check if the user has already made a purchase, e.g. in onResume().
Q: You mentioned obfuscating the code and the IAP SKU keys. But once obfuscated will those SKU keys not be different than the ones added through the developer portal?
No. Code obfuscation is meant to prevent reverse-engineering of your code, not to tamper with your Java code. If you hardcoded your SKUs in Java Code and run code obfuscation properly, your code should execute as expected.
Q: How Amazon handle an In-App purchase if the internet goes off during purchase?
The best approach would be always to check what the status of a receipt is with the Amazon Appstore, using the callbacks provided by the PurchaseListener. However, implementing the In-App purchase API you shouldn’t rely on the internet connection always being present. For example, your users might want to use your app while the device is in airplane mode. A good practice could be to locally store (e.g. in a local database or cache) the most recent status of a purchase/subscription and if there’s no reply from the Appstore due to lack of internet connectivity, rely on the local database and then verify what is the correct status is with Amazon as soon as the connection comes back. Keep in mind that the callbacks from the Appstore are asynchronous, so consider this when implementing the API and the management of the local database.
To discover more about how you can add IAP & Subscriptions to your app, make sure to check out the Understanding In-App Purchasing tech doc.
If you missed the presentation or want to revisit some of the suggestions on how to create effective app promotions, you can watch the webcast any time at the link below: