Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 29    Views: 121

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

AdMob Integration For iOS & Android

Hi Guys I'm really struggling here, I have tried reading various threads to help me add AdMob to my apps, but the way it is explained isn't something I truly understand although the iOS implementation seems to be far more easier even though I haven't successfully got the ads to show in iOS I feel like I'm getting somewhere but cannot say the same for adding the ads to the Android apps. Does anyone have dummies guide to adding AdMob to BT apps, it would be really appreciated.
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
06/27/12 10:59 AM (13 years ago)
Hi, You should download my app to see the results of this tutorial. First you have to install the SDK Second you have to do this for each layout.xml you want to show the ads. I've added a star for each added part. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/header" xmlns:android="http://schemas.android.com/apk/res/android" *******xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:layout_height="fill_parent" android:layout_width="fill_parent" android:background="#FFFFFF" > **********<com.google.ads.AdView android:id="@+id/adView" ***** android:layout_width="wrap_content" ***** android:layout_height="wrap_content" ***** ads:adUnitId="a14fb489255dd5fe3" //change to your ID ***** ads:adSize="BANNER" ***** ads:loadAdOnCreate="true"/> <include layout="@layout/global_title_dark" /> <LinearLayout android:id="@+id/myContent" android:layout_height="fill_parent" android:layout_width="fill_parent" ******* android:layout_marginTop="97dip" //drop your screen to show ads android:orientation="vertical" > <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/myWebView" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> </RelativeLayout> that is for v1.4 apps. But it should still work for 2.0 as well Works for me like a charm. Hope this helps Sevens
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
06/27/12 11:07 AM (13 years ago)
Thanks, I will attempt to follow your guide.
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
06/27/12 01:16 PM (13 years ago)
@dragon007, send me a private message. Fred
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
06/27/12 01:44 PM (13 years ago)
Dragon007, Any luck? Let me know how things go.
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
06/27/12 02:58 PM (13 years ago)
Not to great on any front. iOS, everything looks right, no errors but no ads showing. Android, straight head bang!
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
06/27/12 03:16 PM (13 years ago)
Have you added the sdk to the build path? Updated each screen.XML in your project?
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
06/27/12 03:17 PM (13 years ago)
Right click on it. Select add to build path
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
06/27/12 03:45 PM (13 years ago)
You are talking about Android? I had done all those things, I'm stuck on adding the code in right places or in particular files.
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
06/27/12 04:08 PM (13 years ago)
OK. What screen types do you use? Version of BT do you use? The screens that should be edited are the ones you use. They are found in the res/layout/ folder Select the screen_customText.XML or whatever actually shows in your app.
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
06/28/12 05:29 AM (13 years ago)
Hi Sevens sorry for late reply, this is due to time difference as I'm based in the UK. In regards to your questions: 1. I tend to use a lot of 'Custom URL' screens 2. I'm using BT 2.0 I know where to find the files, just not sure where about to add the code shown above in the page, this what I need help on. Is this the only bit of code I need?
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
06/28/12 05:34 AM (13 years ago)
Yes that's it. You of coarse need to have an admob account. And id Remember to drop your screen by 50 pixels.
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
06/28/12 05:58 AM (13 years ago)
cool, will try shortly and let you know how I get on. Thanks for your help.
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
06/28/12 06:00 AM (13 years ago)
No problem.
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
06/28/12 06:51 AM (13 years ago)
Hi Seven this last piece of code I'm unsure where to place it on page: ******* android:layout_marginTop="97dip" //drop your screen to show ads On my page I have <TextView..... and I have <ImageView..... followed by </RelativeLayout>
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
06/28/12 06:58 AM (13 years ago)
Hi Seven I have an error next to one of the lines I added: ads:adUnitId="a14fb489255dd5fe3" //change to your ID Error says: Element type "com.google.ads.AdView" must be followed by either attribute specifications, ">" or "/>" I have no idea what it means or how to fix, can you help?
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
06/28/12 07:01 AM (13 years ago)
oh ok. Well you should have the emulator running while you do this. So you can view changes immediately. So I would suggest adding to the relativeLayout. refresh the emulator and see how it looks
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
06/28/12 09:07 AM (13 years ago)
Hi Seven unfortunately I just cannot get this to work, I keep getting loads of errors.
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
06/28/12 09:54 AM (13 years ago)
What does the logcat say? Copy and paste logcat (only red and orange ones) here. Let's take a look at the problems.
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
06/28/12 11:04 AM (13 years ago)
delete the comment ://change to your ID
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
06/28/12 11:05 AM (13 years ago)
just remove all comments that i added. they were only to allow you to see the new lines
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
06/29/12 06:22 AM (13 years ago)
Hi Sevens I have managed to stop the errors by deleting some of the text that explains what I need to do, but my app keeps force closing in the simulator, so I'm guessing I have added the code in the wrong place, I have added text to the lines I have added your code. I have added the page code below for you to look at, may be you can tell me where I have gone wrong: <?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/containerView" android:background="@android:color/transparent" (Your Code) android:layout_marginTop="50dip" android:padding="0dip" android:layout_margin="0dip" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/verticalScrollView" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tableLayout" android:layout_width="fill_parent" android:layout_height="fill_parent"> </TableLayout> </ScrollView> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" (Your Code) xmlns:ads="http://schemas.android.com/apk/libs/com.google.ads" android:id="@+id/containerViewHorizontal" android:background="@android:color/transparent" android:padding="0dip" android:layout_margin="0dip" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> (Your Code) <com.google.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adUnitId="a14fec5cedeadd7" ads:adSize="BANNER" ads:loadAdOnCreate="true"/> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/containerViewHorizontalBottom" android:background="@android:color/transparent" android:padding="0dip" android:layout_margin="0dip" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content"> <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/horizontalScrollView" android:layout_width="fill_parent" android:layout_height="wrap_content"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/containerHorizontalButtons" android:background="@android:color/transparent" android:padding="0dip" android:layout_margin="0dip" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content"> </LinearLayout> </HorizontalScrollView> </LinearLayout> </RelativeLayout> </LinearLayout>
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
06/29/12 07:55 AM (13 years ago)
@Dragon, I see where you may be having an issue. If you dont want the ads covered up, everything else must be dropped by 50dip. My menu bar and buttons are the original height + 50dip.
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
06/29/12 07:57 AM (13 years ago)
If you'ld like I could take a look at the package to see where things went wrong. you could send it to shipitnotify at gmail dot com
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
06/30/12 02:49 PM (13 years ago)
Hi Sevens Will do, thanks.
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
07/02/12 10:22 AM (13 years ago)
Hi wanted to know if anyone has experienced the positioning of the AdMob ads or any ads integrated into an app various from page to page, as this is what I have noticed on my iOS app. On some pages the ad seats on top of the tab bar perfectly but on other pages its slightly hidden or to high up the page. Any solutions to this problem?
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
07/02/12 10:26 AM (13 years ago)
In What screen do u have the problem? Have you looked at your layout files and checked the pixel heights?
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
07/02/12 10:49 AM (13 years ago)
I have issues with the menu list screen and some of the custom URL screens in BT 1.5 for iOS.
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
07/07/12 07:49 AM (13 years ago)
Can anyone help solve my issue of adding AdMob to my Android app, below is my code, but my app force closes on all of my custom url screens. Totally confused: <?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> Also the data string to the .jar file for AdMob in the libs folder is different to what it is called in my libs folder, for example in the code I was given above to insert is: xmlns:ads="http://schemas.android.com/apk/libs/com.google.ads" but my .jar file is called this: GoogleAdMobAdsSdk-6.0.1.jar would this have anything to do with why it isn't working and force closing the app on all custom url screens I have used. Really confused, can anyone help.
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
07/15/12 11:01 AM (13 years ago)
 

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.