Third party In-App v3 Library

suggest change

Step 1: First of all follow these two steps to add in app functionality :

1. Add the library using :

repositories {
           mavenCentral()
       }
       dependencies {
          compile 'com.anjlab.android.iab.v3:library:1.0.+'
       }

2. Add permission in manifest file.

<uses-permission android:name="com.android.vending.BILLING" />

Step 2: Initialise your billing processor:

BillingProcessor bp = new BillingProcessor(this, "YOUR LICENSE KEY FROM GOOGLE PLAY CONSOLE HERE", this);

and implement Billing Handler : BillingProcessor.IBillingHandler which contains 4 methods : a. onBillingInitialized(); b. onProductPurchased(String productId, TransactionDetails details) : This is where you need to handle actions to be performed after successful purchase c. onBillingError(int errorCode, Throwable error) : Handle any error occurred during purchase process d. onPurchaseHistoryRestored() : For restoring in app purchases

Step 3: How to purchase a product.

To purchase a managed product :

bp.purchase(YOUR_ACTIVITY, "YOUR PRODUCT ID FROM GOOGLE PLAY CONSOLE HERE");

And to Purchase a subscription :

bp.subscribe(YOUR_ACTIVITY, "YOUR SUBSCRIPTION ID FROM GOOGLE PLAY CONSOLE HERE");

Step 4 : Consuming a product.

To consume a product simply call consumePurchase method.

bp.consumePurchase(“YOUR PRODUCT ID FROM GOOGLE PLAY CONSOLE HERE”);

For other methods related to in app visit github

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents