Adding In-App Billing: Add remove ads button

Hello,

currently i’m having 2 versions of each of my apps in the market. On “full” version for ~5 dollars and a second free version containing Admob banners and interstitials. To make releasing updates easier (and because i only sold couple of full versions each month) i’m thinking of stopping the standalone full version but to contain a remove ads button into the free version.

Does anyone already have already experiences with this conversion?
How much to charge for removing ads?
Or should i maybe keep the full versions but additionally anyway add the ‘remove ads’ button?

I too planning for the same.
Adding Remove-Ads button in free App itself is better option. As user clicks on the button, take him to the page which shows the cost and little more info.
In this way only one version has to be maintained. I am still reading android articles how to do this.
Kindly let me know if anything else is better study material than that.

So i’m currently working on adding this in-app billing things.

Seems this page contains a good tutorial:
Integrating Google Play In-app Billing into an Android Application ? A Tutorial - Techotopia

Thanks for link. useful tutorial.

I was reading following
Implementing In-app Billing <span style=“font-size:16px;”>(IAB Version 3)</span> | Android Developers
Implementing In-app Billing <span style=“font-size:16px;”>(IAB Version 3)</span> | Android Developers

First of all you need to add ads by code (not in xml)
As mentioned above, create a screen with infos about the benefits of removing the ads, this is the page when you have your code for IAP and your “buy” button.
Include the iap code, when you detect the user has bought the item, store the data in sharedprefs (if you want to do it the deluxe way, check from a server, but it’s more painful).
Now where you were showing ads, check first in sharedprefs if user has the paid version, and show a banner ad accordingly.
Make sure you QA your app, lots of potential errors with IAP and ad removing :slight_smile:

why not create a layout with ads and another one without and change them accordingly at runtime?

I’m currently checking the in-app billing example app provided by Google (In-app Billing Overview | Android Developers), seems to be a bit hard to setup and to make sure everything works fine. There’s also a lot of code & classes to add to make in-app billing working and secure.

Yep you can, although i think it’s more simple when you create everything from code, more control & customization
Also, every time you will change your xml code, you will have to edit it in your “mirror” file.

IAP v3 is actually much easier than iap v2 :slight_smile: there is a lot of google coe than you have to copy paste that is used to verify the transaction went well and the item got actually purchsed, but on your own as long as you check the item was bought/consumed there is not much code you need to add.

Good luck

Any idea what should be the charges for removing ads in USA/UK/Au?
Accordingly i will set for other places.

Till now i am doing following in ad verion of the App.

  • Using Admob Banner/Interstitial ads
  • No refresh rate
  • Interstitial ads within App and on exit

There is no “average” price for an adfree version, it really depends on the perception of value of your users i.e. how much do they love your contentand the experience you are offering.
I would start low around .99 and test once in a while with 1.99
Better get 3 users buying .99 than 1 buying a 1.99…

oki, sounds logical. I am new to IAP, so got a basic question.
Rates could be changed later based on the response?

Include the iap code, when you detect the user has bought the item, store the data in sharedprefs (if you want to do it the deluxe way, check from a server, but it’s more painful).
Now where you were showing ads, check first in sharedprefs if user has the paid version, and show a banner ad accordingly.
Make sure you QA your app, lots of potential errors with IAP and ad removing

For me SharedPfefs Way looks good than firing query to Google-Play whenever user opens the App. Have you tried and found it right?
Is it safe to store the Purchased Flag in sharedprefs?

I won’t do it with SharedPref, i will always use the Google-Play service on application startup to check which items were purchased and which not.
Why?
To me creating shared prefs just means some more code making everything more complex without having a real benefit (and shared prefs can also easily be hacked).

I finally took the code out of the Google Example i posted above. This example contains a demo for all different types of items and how to deal with them.
Weakness of this demo is, that some things that are needed for getting a safe solution that can be used on live environment aren’t fully realized / explained (especially the ‘verifyDeveloperPayload()’ and payload when purchasing part, can anyone explain?).

I also already started testing the In-App stuff of my App directly out of Eclipse. This seems to be complex and tricky, because of different application signatures (production vs. debug) and so on. To be able to purchase something like a ‘Remove Ads’ item (can of course only be bought once in real life) multiple times (as you will need for testing), you have to immediately ‘consume’ the purchased item for testing and such things. (That’s only what i experienced till now).

Sometimes i think it would be easier to integrate something like a webview leading to paypal and selling stuff via this somehow. Would also have the positive impact of not loosing 30% of the amount to G**gle.

I finally took the code out of the Google Example i posted above. This example contains a demo for all different types of items and how to deal with them.
Weakness of this demo is, that some things that are needed for getting a safe solution that can be used on live environment aren’t fully realized / explained (especially the ‘verifyDeveloperPayload()’ and payload when purchasing part, can anyone explain?).

Can not comment on this. i am still reading tutorials. may be by tomorrow or beyond i will be able to comment.

Sometimes i think it would be easier to integrate something like a webview leading to paypal and selling stuff via this somehow. Would also have the positive impact of not loosing 30% of the amount to G**gle.

I too feel that 30% of revenue share is huge. but what is the choice? i do not think you can integrate it via paypal/something and bypass google.
Looks like it is bad, still you have to opt for this :mad:

there should be only 5% revenue share with google :confused:.

I’m currently also working on an InAppBilling Manager class (based on the iab utils from google example).
Goal is to make it really easy to implement the In-App stuff in your own apps.

Will post it here for common work on it, when it’s ready for being released as prototype.

App which has Billing Permission in manifest file and includes In-App-Products marked as Paid App in GP?

I was Filling details under “Pricing & Distribution” and it only allows to set price for IAP when we choose it as PAID only.
Please share your experience on this. I do not my App appeared as Paid in GP.

Take a look at: https://github.com/onepf/OpenIAB

Note: I have not yet tried to implement it… it might be horridly buggy/etc.

So finally after some hours of working i can publish first draft of In-App-Billing Manager class(es) that should make it very easy to integrate the in-app-billing v3 into existing apps.

The sources consist of three packages:
com.android.vending.billing => Some google stuff needed for IAB
inappbilling => my work
inappbilling_util => Some helper classes, taken from google iab example (that i posted before)

To integrate IAB into an app:

  1. Edit the ‘InAppBillingSetup.java’ file in the ‘inappbilling’ folder
    => insert your app base 64 encoded key (you will find it in the google play developer console)
    => define your items to be sold

  2. Add the ManagerClass to your activity:



	InAppBillingManager iabManager;
	mIsPremium Boolean;

	/** Called when the activity is first created. */
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);

		iabManager = new InAppBillingManager(this, this);
		iabManager.setIabSetupFinishedListener(new OnIabSetupFinishedListener()
		{
			@Override
			public void onEvent(Boolean success, String errorMesssage)
			{
                                //do something for example
				mIsPremium = false;

				if (success == true)
				{
					mIsPremium = InAppBillingSetup.IAB_SKU_REMOVE_ADS.Purchased();
				} else
					alert("Error occurred!
" + errorMesssage);
			}

		});

		iabManager.setPurchaseFinishedListener(new OnPurchaseFinishedListener()
		{
			@Override
			public void onEvent(Boolean success, String errorMesssage, InAppBillingItem item)
			{
				if (success == true)
				{
					// if no ads item was purchased
					if (item.Id().equals(InAppBillingSetup.IAB_SKU_REMOVE_ADS.Id()))
						//do something;
				} else
					alert("Error occurred!
" + errorMesssage);
			}
		});
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data)
	{
		if (iabManager == null)
			return;

		// Pass on the activity result to the helper for handling
		if (!iabManager.handleActivityResult(requestCode, resultCode, data))
		{
			// not handled, so handle it ourselves (here's where you'd
			// perform any handling of activity results not related to in-app
			// billing...
			super.onActivityResult(requestCode, resultCode, data);
		} else
		{
			;
		}
	}

	@Override
	public void onDestroy()
	{
		super.onDestroy();
		if (iabManager != null)
			iabManager.dispose();
	}


  1. Purchase / consume items, for example like:

				iabManager.purchaseItem(InAppBillingSetup.IAB_SKU_REMOVE_ADS, true, true);

				iabManager.consumeItem(InAppBillingSetup.XXX);

Note:
Those classes are something as a first prototype, so they aren’t fully tested => Errors may occur.
Currently i don’t recommend to already use them in production.
Maybe someone can look over the code and check.
Please send me PM if you would like to contribute and also publish any changed final code.

iab.jpg

in_app_billing_manager.zip (29.7 KB)

What happens if the user starts your app without having an Internet connection?

Shouldn’t matter at all, see the ‘Local Caching’ documentation:
In-app Billing Version 3 | Android Developers
Because the Google Play client now caches In-app Billing information locally on the device, you can use the Version 3 API to query for this information more frequently, for example through a getPurchases call. Unlike with previous versions of the API, many Version 3 API calls will be serviced through cache lookups instead of through a network connection to Google Play, which significantly speeds up the API’s response time.

Little update to the In-App-Billing Manager classes:

-Improved handling of invalid item consumption requests
-Listener event names changed from ‘doEvent’ to ‘onIabSetupFinished’ / ‘onConsumeFinished’ / ‘onPurchaseFinished’

//edit: make sure to not use this version in production, it contains some bugs

in_app_billing_manager_v1.01.zip (29.9 KB)

I’m currently also working on an InAppBilling Manager class (based on the iab utils from google example).
Goal is to make it really easy to implement the In-App stuff in your own apps.

Will post it here for common work on it, when it’s ready for being released as prototype.

Added IAP successfully to remove ads.
I store the flag in shared-prefs as user purchases “remove ads”. I do not CONSUME the item and disable the “purchase” button.
It works fine as long as user does not uninstall the App.

Issue:-
When user purchase,uninstall and install it again i want to query GP regarding the previous purchase without user knowledge and disable ads again and update the flag.
I can check for Already_Owned code as 7 using launchPurchaseFlow(). but it launches the Google GUI to know the purchasing code.
Is there any silent way to esquire the Already_Purchased situation??