• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Problem using AdMod

Pabrick

Newbie
Sep 5, 2011
12
2
Hi,

i'm having problems with the adMob ads, I don't know what else have to do.

My app showme the ads in the emulator, but not in my mobile.

What am I doing wrong?

This is the code of my activity:
Code:
private AdView adView_cuchillas;
...
adView_cuchillas = (AdView) findViewById(R.id.anuncio);
adView_cuchillas.setVisibility(AdView.VISIBLE);
AdRequest request = new AdRequest();
adView_cuchillas.loadAd(request);

My Manifest:
Code:
<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation">
<meta-data android:value="XXXXXXXXXXXXXXX" android:name="ADMOB_PUBLISHER_ID" />
</activity>

My main:
Code:
<com.google.ads.AdView
android:id="@+id/anuncio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="XXXXXXXXXXXXXXX"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"/>

Please help!

Thanks!
 
This is what DDMS Logcat tells me while test in my phone:
In orange:
Code:
09-14 09:14:25.187: WARN/Ads(31290): loadAd called while the ad is already loading, so aborting.

In green:
Code:
09-14 09:14:25.727: INFO/Ads(31290): onFailedToReceiveAd(A network error occurred.)

What does that mean?
 
Upvote 0
Okey the last post means that I didn't have the internet connected, but with the wi-fi connected it tells me this:

Orange (Warning):
Code:
09-14 09:31:26.368: WARN/Ads(31669): loadAd called while the ad is already loading, so aborting.

Green (Info):
Code:
09-14 09:31:27.157: INFO/Ads(31669): onFailedToReceiveAd(Ad request successful, but no ad returned due to lack of ad inventory.)
09-14 09:31:39.187: INFO/Ads(31669): adRequestUrlHtml: <html><head><script src="http://www.gstatic.com/afma/sdk-core-v40.js"></script><script>AFMA_buildAdURL({"preqs":1,"u_sd":1.5,"slotname":"a14e68a5a72bd6d","u_h":533,"u_w":320,"msid":"com.monkeytoons.cuchillasfree2","js":"afma-sdk-a-v4.1.1","isu":"3CAA9FD41C9347D9615EC82C38A118D8","format":"320x50_mb","net":"wi","app_name":"4.android.com.monkeytoons.cuchillasfree2","u_audio":3,"hl":"es"});</script></head><body></body></html>
09-14 09:31:40.127: INFO/Ads(31669): onFailedToReceiveAd(Ad request successful, but no ad returned due to lack of ad inventory.)
 
Upvote 0
Ooookey it's seems I finally solve that problem, but another has appeared!

Now I CAN see the ads.
But when I touch or click on them, my app closes.

Mi DDMS Logcat tells me this:
Red (Error):
Code:
09-14 09:41:42.658: ERROR/Ads(31921): Could not get currentAdManager.
09-14 09:41:42.658: ERROR/Ads(31921): Could not get currentAdManager.
 
Upvote 0
Hmm there could be a number of reasons ,

Could you provide your updated code? Java and xml please

so make sure you dont call load ad twice,
By having loadadoncreate-true in your xml and having loadad(request) in your code.
Its better to chose the code option and remove the xml version so you can load as many times in different times whereas the xml version you can only have called once and thats when its created.


Alsi know that usually when it says onFailedToRecieved(), sometimes there are just no ads currently to load, but the more usrrs that use your app the less freaquent thwt issue becomes.

Also
.setVisibility, is that really needed?

Im guessing you have a attrs.xml ?
if not reply back and ill provide you an easier solution to adding ads
 
Upvote 0
Check out this for a quick easy implementation.
Google AdMob Ads Android Fundamentals - Google AdMob Ads SDK - Google Code

Or this example that is very similar to your implementation.
Add Admob in Android Application | Android Flash Development Guide
(note: in this example you dont need .setGender unless you want to specifically target gender based ads and make sure you remove setTestin when testing is complete).


I hope that helps, sorry for any spelling mistakes, im helping you from my dellstreak lol
 
  • Like
Reactions: Pabrick
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones