Just configure AdMob, I use it in several applications. After you define your application on the AdMob website / control panel, you will see your unique identifier for your application.
Then you just need to add the AdMob banner to your project, if you use simple eclipse, create a libs folder in the project folder, copy the admob jar and eclipse there, right-click and go to "Build path / Add to build path".
Then open the manifest file and add the following to the tag
<meta-data android:value="<YOUR APPLICATION ID FROM ADMOB CONTROL PANEL>" android:name="ADMOB_PUBLISHER_ID" />
Then decide what activity you want to show, I usually place an ad right at the bottom of LinearLayout, so add the following.
<com.admob.android.ads.AdView android:id="@+id/ad" android:layout_width="fill_parent" android:layout_height="wrap_content" myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF" myapp:secondaryTextColor="#CCCCCC" />
At the top of the layout definition, in which you define the xml namespace, you will see
xmlns:android="http://schemas.android.com/apk/res/android"
also add a link to the admob namespace so you have:
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:myapp="http://schemas.android.com/apk/res/net.dbws.fv" **<-- change package (net.dbws.fv) to your package**
Finally, create a file called attrs.xml in the values folder and paste the following:
<?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="com.admob.android.ads.AdView"> <attr name="backgroundColor" format="color" /> <attr name="primaryTextColor" format="color" /> <attr name="secondaryTextColor" format="color" /> <attr name="keywords" format="string" /> <attr name="refreshInterval" format="integer" /> </declare-styleable> </resources>
Then you should be good to go, of course, I did not need to do something else for real devices, unlike the emulator, the above should work for you. You do not always see the announcement, especially the first few times when you start the application, but if you see ADMOB entries on your logcat output when you start the application, you can be sure that it works.
Hi