Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 14    Views: 177

Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
05/24/12 09:58 AM (13 years ago)

Admob intgration

I have hit a bump. I've tried just about all I can think of when it comes to adding Admob to the next release of my app. Having serious trouble compliling and receiving the add on any device or emulator. this is a 1.4 app and I am working in eclipse with android api 4. I've search blogs for any definitive responses but none yet. HELP! I'm gonna scream! Sevens
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
05/24/12 10:05 AM (13 years ago)
i have xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" at the top of the screen of global title dark then <com.google.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adUnitId="my_ID" ads:adSize="BANNER" ads:loadAdOnCreate="true"> </com.google.ads.AdView> Is this all I need to see ads running?
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
05/24/12 10:28 AM (13 years ago)
and the manifest entry for screens. Also, if you're using the latest admob sdk you'll have to change the build level if you haven't already.
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
05/24/12 10:57 AM (13 years ago)
I have this in manifest <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> had to make it look like this to remove errors. <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation"/>
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
05/24/12 10:58 AM (13 years ago)
it says build level should be 13 but everything else wont work because 1.4 apps are for API level 4. What should I do?
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
05/24/12 11:04 AM (13 years ago)
What happens if you change the build level to 13? It shouldn't make a difference as your minimum build level (4) is set in the manifest. (and keep the longer activity in the manifest)
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
05/24/12 11:08 AM (13 years ago)
Well let me see. Because level 4 was the only one I could use when I setup the first google maps API. I may have to remove my maps. Brb gonna try.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
05/24/12 11:22 AM (13 years ago)
What's the latest admob sdk? I've got an early 4.3.1 version here, it might not need the longer manifest entry or higher build level, which could solve your problems. Hold on, I'll post a dropbox link in a minute.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
05/24/12 11:26 AM (13 years ago)
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
05/24/12 03:38 PM (13 years ago)
trying now
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
05/24/12 05:02 PM (13 years ago)
Definitely not working. Close but no cigar. Seems to me that the server is refusing to interact with the app now that there is a change to the act_activitybase. I did install the older admob SDK and placed everything how the blogs mention. Just not working. I may never monetize :-(
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
05/24/12 05:07 PM (13 years ago)
You'll monetize! If you like, send your project over to paul9qr @ btinternet (dot) com and I'll take a look. Not promising anything and not sure if I can take a look tonight, it's getting late.
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
05/25/12 07:22 AM (13 years ago)
Got the adjusted project from you. I works. I'm gonna have to remember that I should program in either java or xml and not both for the same function. For the benefit of all... here is what raveyd said to me... Here's the project, it should be ok. Had to make a couple of changes. The banners are across the top of the screen. It's hard to get them at the bottom in V1.4 - you have to do an awful lot of tweaking of dimensions in the xml files because all the positioning is relative to the top of the screen. Setting them up at the bottom is a real hair puller! The logo is very big on my device, it takes up most of the screen, I'd suggest making it 320x100 or even smaller. It's currently 320x150. If you change the size, change it in the act_home.xml file too. If you make the image 320x100, then change the dimension to the same in the 'image view' section, and also change the dimension in the 'linear layout' section from 249 to 199 (50 less). Hope that makes sense? The problem was that you were trying to implement two different methods for serving ads. Programatically via the java file and hard coded via the xml file. The code in the java file was ok, but in completely the wrong place. Instead of putting it all together at the bottom of the file, it should have been split out and added to existing methods, for example the private ad view line should have been at the start of the file with the other private views. Also, the activity_base wasn't really the best place to put it, act_home would have been better. In that file you can see all the existing methods. So, I removed the code in the java file and went with the hard coded method, which is better for v1.4. If you move onto v1.5 or v2.0, the programatic method is best. If you look at the various xml files, you should see the changes I've made. In v1.4 you have to put the code in the individual files, there's no global setting that seems to work. So there are a number of xml files with the code in, mostly screen xml's. Check them out and maybe you could try adding the code to other screens, although I think I've added it to most of them. Also, I checked out your map. The overlay is ok, but there's no actual map? I've seen this posted about loads of times on the forum, but I don't know much about maps, so I left it alone. I'm sure a solution will be on the forum. Hope all that makes sense! Cheers,
 
Sevens
Code is Art
Profile
Posts: 146
Reg: Jan 28, 2012
New York Metro ...
11,960
like
05/25/12 07:24 AM (13 years ago)
The Android banner sample doesnt explain that you have to split up the code into its individual parts in the java file. Thanks Raveyd!
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
07/15/12 11:03 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.