Shortly after our initial release of the Pack Store in Fragment earlier this year, other companies started contacting us wanting Fragment on their App stores, as well. With the addition of the Pack Store, and in app purchases, this made things challenging.

When I first implemented the Pack Store, I used Sergey Solovyev’s excellent Android Checkout library to implement the In App Billing support. This is a great library that eased a lot of the pain of the IAB implementation, but tightly coupled Fragment with the Google Play Store.

In order to release with more stores and partners, I needed a more open solution. As the developer of Fragment, and the person that has to manage builds and releases, I wanted to avoid having multiple build flavors to cover all the stores, since that would quickly get unweildy. My search for a more open IAB solution led me to OpenIAB.

OpenIAB

OpenIAB is a library from the One Platform Foundation designed for exactly this purpose. They’ve abstracted the different store implentations so that you can use one build with all the stores. This means I don’t have to manage a different build for each store we want to release on.

For it’s API, it uses the familiar IabHelper architecture from Google’s TrivialDrive sample. This makes migration easy, whether you’re coming from another library like Android-Checkout, or the copy and pasted code from the samples.

While I updated the code, I decided to wrap the implementation with RxJava for convenience. I’ll get to more of this in a future post.

After updating the code, you simply need to set up developer accounts on other stores and add your purchasable items. We chose to go with the Amazon Appstore as our first additional store, since it’s a well known one here in the US, and their App Tester tool makes testing in app purchases remarkably easy.

Results

For now, Fragment is available on both Google Play and the Amazon Appstore, but we have plans to move to more stores soon. We have yet to see what kind of impact this will have on Fragment’s success, but with an easy implementation and broader exposure available to the Android platform, it’s an experiment well worth doing. I’ll be sure to report back once we have some results.