[android] google play in app billing

23
By : Franky Wijanarko PT. BUZOO INDONESIA

Upload: jun-shimizu

Post on 24-May-2015

3.591 views

Category:

Technology


10 download

DESCRIPTION

PT.BUZOO INDONESIA is No1 Japanese offshore development company in Indonesia. We are professional of web solution and smartphone apps. We can support Japanese, English and Indonesia. We are hiring now at http://buzoo.co.id/

TRANSCRIPT

Page 1: [Android] Google Play in app billing

By : Franky WijanarkoPT. BUZOO INDONESIA

Page 2: [Android] Google Play in app billing

In-app Billing is a Google Play service that lets you sell digital content from inside your applications

You can use In-app Billing to sell products as:- Standard in-app products (one-time billing), - Subscriptions, (recurring, automated billing)

Any application that you publish through Google Play can implement In-app Billing.

Page 3: [Android] Google Play in app billing

In-app Billing version 1 March 2011 In-app Billing version 2 May 2012 In-app Billing version 3 February 2013

Page 4: [Android] Google Play in app billing

Managed In-app ProductsThis means that the user's ownership of all in-app item purchases is maintained by Google Play, and your application can query the user's purchase information when needed.

Page 5: [Android] Google Play in app billing

2 Types of Managed In-app Products :◦ Non-consumable Items

Once purchased, these items will be permanently associated to the user's Google account. An example of a non-consumable in-app product is a premium upgrade or a level pack.

◦ Consumable itemsImplement consumption for items that can be made available for purchase multiple times. Typically, these items provide certain temporary effects. For example, the user's in-game character might gain life points or gain extra gold coins in their inventory.

Page 6: [Android] Google Play in app billing

SubscriptionsA subscription is a product type offered in In-app Billing that lets you sell content, services, or features to users from inside your app with recurring monthly or annual billing.

Page 7: [Android] Google Play in app billing

To implement In-app Billing in your application, you need to do the following:1. Installing the Google Play Billing Library

Check whether or not the library is installed by launching the Android SDK Manager by selecting the Eclipse Window -> Android SDK Manager menu option, scroll down to the Extras section and the Status column next to the Google Play Billing Library

Page 8: [Android] Google Play in app billing
Page 9: [Android] Google Play in app billing

2. Adding Billing Permission to the Manifest File

Page 10: [Android] Google Play in app billing

3. Adding the IInAppBillingService.aidl File to the Project

Page 11: [Android] Google Play in app billing

4. Adding the Utility Classes to the Project

Page 12: [Android] Google Play in app billing

5. Obtaining the Public License Key for the Application

Create new Application Click on the Services & APIs option to display the

Base64-encoded RSA public key for the application

Page 13: [Android] Google Play in app billing

6. Setting Up Google Play Billing in the Application

Page 14: [Android] Google Play in app billing

After success, we can add additional code to get an inventory of stuff we own : mHelper.queryInventoryAsync(mGotInventoryListener);

mGotInventoryListener -> Listener that's called when we finish querying the items and subscriptions we own

Page 15: [Android] Google Play in app billing
Page 16: [Android] Google Play in app billing

7. Initiating a Google Play In-app Billing Purchase

NOTE: MainActivity.this -> A reference to the enclosing Activity instance from which the

method is being called ITEM_SKU -> The SKU that identifies the product that is being purchased 10001 -> he request code which can be any positive integer value mPurchaseFinishedListener -> The listener method to be called when the purchase is

complete "<payload>" -> The developer payload string. This can be any string value and can

be used to identify the purchase, or may be left empty

Page 17: [Android] Google Play in app billing

8. Implementing the onActivityResult Method

Page 18: [Android] Google Play in app billing

9. Implementing the Purchase Finished Listener

If we use new Security.java, it cause a problem when using SKU testing. So we have to replace verifyPurchase function with the old version of Security.java

Page 19: [Android] Google Play in app billing

10. Releasing the IabHelper Instance

11. Testing the In-app Billing Application

Page 20: [Android] Google Play in app billing

12. Creating a New In-app Product We have to upload signed APK to Google Play

Developer Console. Create a new product, set the product type to

Managed product, enter a Product ID (it wil be our ITEM_SKU).

In the second screen enter a title, description and price for the item.

Change the menu at the top of the page to Activate.

Save

Page 21: [Android] Google Play in app billing

13. Adding In-app Billing Test Accounts Google will not allow developers to make test

purchases from their own Google accounts. In order to test in-app billing from this point on, it

will be necessary to setup other Google accounts as testing accounts.

To add a test user account : Click on the Settings icon located on the left hand side of your Google Play Developer

Console home screen and on the account details screen scroll down to the License Testing section. In the Settings icon located on the left hand side of your Google Play Developer Console.

Scroll down to the License Testing.

Page 22: [Android] Google Play in app billing

As long as the application remains in draft status within the Google Play Developer console, no charges will be incurred by the user whilst testing the in-app billing

Resource: Sprix Project http://developer.android.com/google/play/billing

/index.html http://www.techotopia.com/index.php/

Integrating_Google_Play_In-app_Billing_into_an_Android_Application_%E2%80%93_A_Tutorial

Page 23: [Android] Google Play in app billing

Thank you