Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 9    Views: 320

Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
07/10/12 10:15 AM (13 years ago)

AdMob Integration For Android Need Help!

Hi I have tried everything to get these ads to show up in my Android app with no luck, does anyone have a clear guide or better still a video tutorial. At the moment my custom url pages keep force closing so I have done something wrong but unsure what. Not even sure if I have added the code in the right places, can anyone help! <?xml version="1.0" encoding="UTF-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/libs/com.google.ads" android:id="@+id/containerView" android:background="@android:color/transparent" android:layout_width="fill_parent" android:layout_height="fill_parent"> <com.google.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adUnitId="a14feafcba0a3e4" ads:adSize="BANNER" ads:loadAdOnCreate="true"/> <LinearLayout android:id="@+id/subContainer" android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="center_horizontal" android:layout_marginTop="97dip" android:orientation="vertical"> <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webView" android:layout_width="fill_parent" android:layout_height="fill_parent"> </WebView> </LinearLayout> </RelativeLayout>
 
nishad
Lost but trying
Profile
Posts: 61
Reg: May 06, 2012
cochin
610
like
07/14/12 04:52 AM (13 years ago)
Step 1. Download the Admob sdk then In eclipse, right click on the project name and select Properties. Select Java Build Path on the left and then make sure the Libraries tab is selected at the top. Then click Add External JARS... on the right side of the window. Navigate to where you saved the unzipped AdMob sdk and select the .jar file. Step 2. Added These two Line in AndroidManifest.xml before the closing application tag ..................................................... <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> ..................................................... Step 3. Modify your screen_menulist.xml ..................................................... <com.google.ads.AdView android:layout_height="wrap_content" android:id="@+id/adView" android:layout_width="wrap_content" ads:adUnitId="Your ADD MOB ID" ads:adSize="BANNER" ads:loadAdOnCreate="true" android:layout_alignParentBottom="true"> </com.google.ads.AdView> </RelativeLayout> .................................................... Note :- Don't Forget to Add xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" After <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" .................................................... My :- screen_customhtml.xml .................................................... <?xml version="1.0" encoding="UTF-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:id="@+id/containerView" android:background="@android:color/transparent" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:id="@+id/subContainer" android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="center_horizontal" android:orientation="vertical"> <com.google.ads.AdView android:layout_height="wrap_content" android:id="@+id/adView" android:layout_width="wrap_content" ads:adUnitId="Your ADD MOB ID" ads:adSize="BANNER" ads:loadAdOnCreate="true" android:layout_alignParentBottom="true"> </com.google.ads.AdView> <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webView" android:layout_width="fill_parent" android:layout_height="fill_parent"> </WebView> </LinearLayout> <com.google.ads.AdView android:layout_height="wrap_content" android:id="@+id/adView" android:layout_width="wrap_content" ads:adUnitId="Your ADD MOB ID" ads:adSize="BANNER" ads:loadAdOnCreate="true" android:layout_alignParentBottom="true"> </com.google.ads.AdView> </RelativeLayout>
 
nishad
Lost but trying
Profile
Posts: 61
Reg: May 06, 2012
cochin
610
like
07/14/12 04:53 AM (13 years ago)
see that you dont copy paste things copy from respective files given by google!
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
07/15/12 08:32 AM (13 years ago)
Hi Nishad is this guide for BT 2.0?
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
07/15/12 10:00 AM (13 years ago)
Hi Nishad I have made some progress with the ad integration, not getting loads of errors like before. However when I launch the app on my device I get an ad banner box that says: You must have AdActivity declared in AndroidManifest.xml with configChanges. Do you know how I can fix?
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
07/15/12 10:59 AM (13 years ago)
Hi Nishad got the ads going, went through your guide, you had one thing missing and that was to set the 'Project Build Target' to Google 3.2 api. Anyone wanting to ad AdMob Framework, this was a very good guide and actually very simple, even though it had taken me a month.
 
ElleEyeEssay
Code is Art
Profile
Posts: 36
Reg: Jul 08, 2012
Santa Barbara, ...
4,510
like
07/21/12 11:10 PM (13 years ago)
Hi Dragon007, Did you have any problems changing the Project Build Target to Google 3.2 when BT 2.0 is supposed to be set up for 2.2?
 
basdeninc
Aspiring developer
Profile
Posts: 16
Reg: Sep 18, 2011
atlanta
160
like
10/11/12 02:39 AM (13 years ago)
has anyone else got this to work, my project wont build and I followed everything to the letter, I think.
 
HelperDev
Lost but trying
Profile
Posts: 49
Reg: Nov 16, 2012
New York
3,090
like
03/11/13 05:21 PM (12 years ago)
doesn't work for me...
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
03/13/13 03:35 AM (12 years ago)
Admob from what I remember only works with target Google 3.2 api. Remember BT have done updates to Android framework, this guide may or may not work anymore. Basdeninc, really sorry that I never saw your post, I don't seem to get notifications from post anymore, don't know why.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.