How to Add Advertisements to Your Android Applications Using Admob

Create an AdMob account by browsing to http://www.admob.com; , Once your AdMob account is created, Login to your account. , Click on sites & Apps tab on the top menu., Select the platform your created application is, in this case select Android...

26 Steps 2 min read Advanced

Step-by-Step Guide

  1. Step 1: Create an AdMob account by browsing to http://www.admob.com;

    Then click on Add Site/App button to add the application you want your advertisements to show up on. ,, You should already know the application name and the package name for your application.

    Therefore write the name of your application in the app name field, and write the android package URL as market:.

    Enter your package name by replacing the <Package name >.

    For category select what type of app your application is, and write a small description in the description box to tell what type of app it is.

    There is also an option to include Google ads, which can be useful to get ad fills when AdMob ads are not displayed. , Click on the download button to download the SDK. ,,, Find the folder containing your Android application and right click to choose properties option. , Click on “Add external JARS…” button and locate the unzipped AdMob SDK JAR file on your disk, and add it to your project. ,, In order to use AdMob in your application you must include the following xml Just before the </application> tag enter a new activity for com.google.ads.AdActivity by adding this xml.<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />” ,, AdMob SDK requires android SDK-13, and since our application was SDK-7 we require changing the target version, target=android-13. , For this tutorial we will just add it to our main.xml located under res/layout folder of our project.

    Then add this following xml where you like to show your ad in your layout.

    In <LinearLayout> tag add xmlns:ads= "http: tag add <com.google.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adSize="BANNER" ads:adUnitId="YOUR PUBLISHER ID" ads:loadAdOnCreate="true" > </com.google.ads.AdView>
  2. Step 2: Once your AdMob account is created

  3. Step 3: Login to your account.

  4. Step 4: Click on sites & Apps tab on the top menu.

  5. Step 5: Select the platform your created application is

  6. Step 6: in this case select Android.

  7. Step 7: Enter the required details to add an app to the list.

  8. Step 8: Once you hit continue

  9. Step 9: AdMob will add your application to the list and ask you to download the AdMob Android SDK.

  10. Step 10: While AdMob SDK is downloading

  11. Step 11: click on the go to Sites/Apps button to return to your list applications

  12. Step 12: then click on manage settings on the listed app to find your publisher ID.Save this information for future use in Eclipse to incorporate AdMob in your application.

  13. Step 13: Extract the downloaded .Zip file with the AdMob Android SDK to an easily accessible location.

  14. Step 14: Now start your Eclipse IDE to import the downloaded SDK.

  15. Step 15: Select “Java Build Path” option from the navigation plan to your left and then click on “libraries tab” to add the SDK file.

  16. Step 16: If you successfully completed the previous step

  17. Step 17: you should now see the JAR file located under

  18. Step 18: Referenced Libraries folder inside your project.

  19. Step 19: Once the SDK is added to your project

  20. Step 20: open the AndroidManifest.xml file located in your project.

  21. Step 21: After the </application> tag enter permissions that are required by AdMob.<uses-sdk android:minSdkVersion="7" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

  22. Step 22: Open the project.properties file in your Android application folder and change this line of code at the end of the file to make AdMob SDK work.

  23. Step 23: Finally

  24. Step 24: to add an AdMob advertisement to your application

  25. Step 25: open your desired layout xml file.

  26. Step 26: Run your application and give it up to 5 minutes on initial run to have AdMob ads show on your application.

Detailed Guide

Then click on Add Site/App button to add the application you want your advertisements to show up on. ,, You should already know the application name and the package name for your application.

Therefore write the name of your application in the app name field, and write the android package URL as market:.

Enter your package name by replacing the <Package name >.

For category select what type of app your application is, and write a small description in the description box to tell what type of app it is.

There is also an option to include Google ads, which can be useful to get ad fills when AdMob ads are not displayed. , Click on the download button to download the SDK. ,,, Find the folder containing your Android application and right click to choose properties option. , Click on “Add external JARS…” button and locate the unzipped AdMob SDK JAR file on your disk, and add it to your project. ,, In order to use AdMob in your application you must include the following xml Just before the </application> tag enter a new activity for com.google.ads.AdActivity by adding this xml.<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />” ,, AdMob SDK requires android SDK-13, and since our application was SDK-7 we require changing the target version, target=android-13. , For this tutorial we will just add it to our main.xml located under res/layout folder of our project.

Then add this following xml where you like to show your ad in your layout.

In <LinearLayout> tag add xmlns:ads= "http: tag add <com.google.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adSize="BANNER" ads:adUnitId="YOUR PUBLISHER ID" ads:loadAdOnCreate="true" > </com.google.ads.AdView>

About the Author

K

Kayla Baker

Dedicated to helping readers learn new skills in practical skills and beyond.

35 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: