Adding Ads to your Android App to Monetize it – Using Admob

If you currently are, or are planning on developing for android then you may want to think about ads.

Some ads are pretty intrusive and ruin a users experience, while some ads that are designed well can bring in some extra revenue without ruining your apps experience. I am talking about Admob. Admob is easy to use, lightweight, has many subscribers, and is very easy to manage.

First you need to sign up with Admob, this is easy to do. Go to http://www.google.com/ads/admob/ and sign up. You can use your gmail account which makes things easier. Once you sign up, you can ad your app. At this time, you would login and then click the “Sites and Apps” tab. From here you click “Add Site/App.

You can use Admob with android and iphone which is great. You can track your apps for two platforms with one tool (you actually can use it for Windows Phones too). This allows you to expand into other platforms while keeping the same ad management tool all in one area.

You enter your app details, the name, description, for URL just put http:// for now until the app is on the market if you wish to put it on the market.

Your app ad details. Click on the Sites and Apps tab. Hover over your app and click Manage Settings. Here you find your App ID code which you use for your app to track your ads. If you click on publisher code you can download the SDK which is used to insert the ad into your app.

Next you need to enter the ad code into your app. I use eclipse so I will explain it using that. Many people experience a frustrating error with their projects with the ad SDK. To import it properly, find the file on your computer and drag it into your projects “libs” folder. This is the only way I have been able to have no error when compiling the project.

Once the SDK is in your project you can go to your projects layout XML and enter the following:

 <com.google.ads.AdView
android:id=”@+id/adView”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
ads:adSize=”BANNER”
ads:adUnitId=”YOUR ID”
ads:loadAdOnCreate=”true” >
</com.google.ads.AdView>

For testing, add: ads:testDevices=”TEST_EMULATOR, TEST_DEVICE_ID”

Make sure you remove that line before release or else your ads will still be in test mode.

In order to get everything working, in your layout XML you must add:

    xmlns:ads=”http://schemas.android.com/apk/lib/com.google.ads”

to where your layout is (where xmlns:android=”http://schemas.android.com/apk/res/android” is).

 

Lastly, you must edit your Manifest and insert:

 <uses-permission android:name=”android.permission.INTERNET” />
<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE”/>

Along with:

<activity android:name=”com.google.ads.AdActivity” android:configChanges=”keyboard| keyboardHidden| orientation| screenLayout| uiMode| screenSize| smallestScreenSize”

 

Now compile your code and run it!

 

This was a very low level overview of how to get Admob running. The resources on Admob are amazing, but if you encounter errors make sure the above is correct as they are your common mistakes. The libs error is a frustrating one as you may not notice it right away.

 

 

Summary of Admob:

Pros:

  • Easy to use
  • Works on multiple platforms
  • Huge network
  • Easy to use and a huge network…

Cons

  • Cannot think of any

 

 

Later I will post on using ads for blackberry, and then compare the two services (blackberry ad service vs. googles).

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *