Many developers have already had great success with porting their Android™ applications to the BlackBerry® PlayBook™ tablet platform. This provides a great distribution channel for your applications and opens them up to a whole new audience.
“That’s all great”, you might say, “but how do I sell digital goods from within my application to increase my revenue stream?” I am happy to let you know that the BlackBerry® Runtime for Android Applications now supports the Android In-App Billing APIs in the recently-released 2.1.0 developer beta build!
How does it all work? Let’s start with the basics: the APIs used to make purchases in an Android application have been modified to integrate with the BlackBerry App World™ storefront. As a developer, you can add Digital Goods in the BlackBerry App World ISV Portal and then offer them for sale in your application. The really good news? The system works with the existing BlackBerry Payment Service, meaning that you can use the same Digital Goods SKUs as used previously for Item ID in the Android payment system. The rest of the Android In-App Billing APIs will continue to function as expected, which means minimal client-side code changes. All purchases made from your Android application will appear to the end user with the exact same flow as it would in a native BlackBerry PlayBook tablet application, validated and charged via BlackBerry App World.
There are a few things to keep in mind when adding this functionality to your ported Android application:
- In order to test your in-app purchases, you will need to follow the steps outlined here
- Only one purchase may be made at a time; concurrent transactions are not currently supported
- Refunds are not supported from the APIs
- Transaction responses are not signed, so they cannot be checked (see below for more information)
Transaction Responses Are Not Signed
If your application attempts to verify the transaction response signature, then it will need a slight code tweak to disregard this value if testing on a BlackBerry PlayBook tablet or BlackBerry® 10 device. The easiest way to tell if your application is running on a BlackBerry device is to use the following code:
java.lang.System.getProperty("os.name") == “qnx”
If the above check is true then you should skip the transaction signature verification.
There are a few differences to how things will be referred to when switching to the BlackBerry App World Payment system. Below is a list of some of the most common changes:
|Optional “developer payload”||“metadata”|
That covers the basics. If you have any questions, comments or success stories, please send them our way — we’d love to hear what you have to say!