Logo Icon Logo
A Crowd-sourced Cookbook on Writing Great Android® Apps
GitHub logo Twitter logo OReilly Book Cover Art

Monetizing Your App with AdMob

Problem:

You want to monetize your free app by showing ads within it.

Solution:

Using Admob Libraries you can start using ads in your free app, getting money for each click.

Discussion:

AdMob is one of the world's largest mobile advertising networks, offering solutions for discovery, branding and monetization on mobile phones.

The AdMob Android SDK contains the code necessary to install AdMob ads in your application.

Step 1

In your project's root directory create a subdirectory libs. This will already be done for you if you used Android's activitycreator tool. Copy the AdMob JAR (admob-sdk-android.jar) file into that libs directory.

For Eclipse projects:

  1. Right-click on your project from the Package Explorer tab and select Properties
  2. Select Java Build Path from left panel
  3. Select Libraries tab from the main window
  4. Click on Add JARs...
  5. Select the JAR copied to the libs directory
  6. Click OK to add the SDK to your Android project

Step 2

Add your publisher ID to your AndroidManifest.xml . Just before the closing </application> tag add a line to set your publisher ID. If your publisher ID were 149afxxxx, the line would look like this:

<meta-data android:value="a149afxxxx" android:name="ADMOB_PUBLISHER_ID"/> </application>

To find your publisher ID, log into your AdMob account, select the Sites and Apps tab, and click on the Manage Settings link for your site. On this page, you can find your publisher ID as shows figure 1.

See Also:

http://www.admob.com/ http://androidtitlan.org/2010/09/como-agregar-publicidad-con-admob-a-tu-android-app/ http://groups.google.com/group/admob-publisher-discuss

Downloads: