Tag Archives: in-app purchase

Tutorial: How to Implement In-app Billing in Android – Part 2

Part 1 of this article was my guide on how to get started with in-app purchases in Android. It was published in July 2014. Finally, here is part 2. …

Part 1 covered the operational side of things: defining in-app products, application keys, etc. In this article, I will offer some suggestions on how to adapt the TrivialDrive code for your own app. The code provided with TrivialDrive is very well structured and we all can learn a lot from it. Most of the hard work is done in classes inside the util package of TrivialDrive. Without that package, the MainActivity would be much more difficult. The changes I suggest below are refinements on what is in the MainActivity provided by the Google team.
For my own work, I made the transition from the in-app purchases of the TrivialDrive sample app (Figure 1, left) to the purchases of my space war app (Figure 2, right). Continue reading

Posted in Android | Tagged , , , , | 14 Comments

Tridroid Presentation: In-App Purchases for an Android Game

I gave a presentation on August 7 to my local Android developers’ Meetup group, Tridroid. The presentation was on in-app purchases. The following topics were covered.

… In-App Purchases example: Trivial Drive
… Different revenue models for apps
… In-App Billing for Android
… What you should consider for in-app purchases
… How in-app purchases are handled in other apps (Angry Birds, Temple Run, Candy Crush Saga)
… In-app purchases in Double Star
… How many in-app items should you have?
… How do you call the player’s attention to them?
… Pricing considerations
… How to implement In-App Billing
… TrivialDrive example app
… Adapting example to your own app

… Download. If you’d like to download the presentation, the link is in the full article.
Continue reading

Posted in Android, Game Design | Tagged , , , , | 3 Comments

Tutorial: How to Implement In-app Billing in Android – Part 1

In an earlier article, I wrote about in-app billing inside an Android game app I am working on. This is the first of two follow-up articles in which I explain how to add in-app billing to your game or other app. In this article I will walk you through the steps for the TrivialDrive example program from the Android Developers website. That website provides a sample in-app billing (IAB) app. It shows you how to do simple in-app purchases and subscriptions. … The focus on this article has been on getting a working example going. That is a really important step. The TrivialDrive app will be your reference app as you move ahead with your own app. I do not recommend skipping the TrivialDrive example. There are too many things that can go wrong if you are learning the basics of in-app billing at the same time as you are adding items to your own app. Continue reading

Posted in Android | Tagged , , , , | 23 Comments

In-app Billing in an Android Space War Game

I am writing a series of articles about how to implement in-app billing for an Android game app. I will get that started by telling you something about the game app I am working on and how in-app purchases tie in to upgrades within the game. …

Starship is a turn-based, single player, space war game. You command a very powerful starship. Your mission is to find and destroy alien starships that have invaded the galaxy. … As you play the game, you earn gold coins. The coins can be used to purchase items that improve your capabilities. …

This is the first of a set of articles. Topics covered:
suggestions on how to get started with the TrivialDrive demo program from the Android Developers website;
adapting the TriviaDrive demo to your own application;
tips and suggestions for testing in-app billing;
how to implement your own Upgrades screen;
different ways to invite players to upgrade. Continue reading

Posted in Android, Game Design | Tagged , , , , | 3 Comments

Android Fragment for an Item in a Store

I am working on a game that has items that players can buy from a store. I needed a way to display the list of items on the screen. I am using a StoreItemFragment to display them on the screen. In this blog post, I describe a demo app that I built that uses the fragment in a list of items for sale.
Each item for sale has a picture, a description, and a button to push to make the purchase. The image next to the purchase button indicates the currency used for the payment. In this demo, players pay in gold coins or crystals. I plan to use this Fragment for purchases made in the game with virtual currency, and I will use it with a second activity where the player can start an in-app purchase using real money to purchase game coins.

(Note: This is an excerpt of the blog article. Click the link for the full article, which includes screenshots, detailed explanations, and a link to the full source code.) Continue reading

Posted in Android, Game Design | Tagged , , , , , | 7 Comments