From the past 1 year survey (Not sure it is still valid), it seems that developers generate more revenue in Amazon App Store than Google Play. That's surprising, as I thought Google Play is found in every Android devices. It suppose to generate most revenue. Not sure why.
Hence, I was planning to give a try in Amazon App Store. However, I realize I need to maintain 2 set of in-app purchase code, for Google Play and Amazon App Store?
I was wondering, how do most of you maintain such code? Besides using RoboBillingLibrary . I still try not to rely on 3rd party library, unless I really have to. As it is not easy to have a stable in-app purchase flow. I receive crash report once a while regarding in-app purchase, and have no idea why. Although almost all the code is just merely copy n paste from official code example.
I use a BAT file to build the different versions (Android, Kindle Fire, iOS). Each version is built with a different value for a conditional compilation symbol that indicates the target marketplace.
I use this approach for my code:
In each method of the main Billing class, the conditional compilation symbol is used to call the corresponding method in one of the three market Billing classes. The market-specific code handles the details.
class Billing implements IBilling { void init() { if marketplace-conditional-var == 'G' BillingGoogle.init(); if marketplace-conditional-var == 'A' BillingAmazon.init(); if marketplace-conditional-var == 'P' BillingApple.init(); } // similar code for isAvailable(), purchase(sku), etc. follows }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.