1. Download our Official Android App: Forums for Android!

Apps Problem using AdMod

Discussion in 'Android Development' started by Pabrick, Sep 13, 2011.

  1. Pabrick

    Pabrick Newbie
    Thread Starter
    Rank:
    None
    Points:
    36
    Posts:
    12
    Joined:
    Sep 5, 2011

    Sep 5, 2011
    12
    2
    36
    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 (Text):
    1.  
    2. private AdView adView_cuchillas;
    3. ...
    4. adView_cuchillas = (AdView) findViewById(R.id.anuncio);
    5. adView_cuchillas.setVisibility(AdView.VISIBLE);
    6. AdRequest request = new AdRequest();
    7. adView_cuchillas.loadAd(request);
    8.  
    My Manifest:
    Code (Text):
    1.  
    2. <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation">
    3. <meta-data android:value="XXXXXXXXXXXXXXX" android:name="ADMOB_PUBLISHER_ID" />
    4. </activity>
    5.  
    My main:
    Code (Text):
    1.  
    2. <com.google.ads.AdView
    3. android:id="@+id/anuncio"
    4. android:layout_width="wrap_content"
    5. android:layout_height="wrap_content"
    6. ads:adUnitId="XXXXXXXXXXXXXXX"
    7. ads:adSize="BANNER"
    8. ads:loadAdOnCreate="true"/>
    9.  
    Please help!

    Thanks!
     

    Advertisement

  2. qasimValent

    qasimValent Member
    Rank:
    None
    Points:
    16
    Posts:
    39
    Joined:
    Jun 29, 2010

    Jun 29, 2010
    39
    6
    16
    RG
    Check the logcat in DDM perspective and reply back what error you get,it should be in orange text.
     
    Pabrick likes this.
  3. Pabrick

    Pabrick Newbie
    Thread Starter
    Rank:
    None
    Points:
    36
    Posts:
    12
    Joined:
    Sep 5, 2011

    Sep 5, 2011
    12
    2
    36
    This is what DDMS Logcat tells me while test in my phone:
    In orange:
    Code (Text):
    1.  
    2. 09-14 09:14:25.187: WARN/Ads(31290): loadAd called while the ad is already loading, so aborting.
    3.  
    In green:
    Code (Text):
    1.  
    2. 09-14 09:14:25.727: INFO/Ads(31290): onFailedToReceiveAd(A network error occurred.)
    3.  
    What does that mean?
     
  4. Pabrick

    Pabrick Newbie
    Thread Starter
    Rank:
    None
    Points:
    36
    Posts:
    12
    Joined:
    Sep 5, 2011

    Sep 5, 2011
    12
    2
    36
    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 (Text):
    1.  
    2. 09-14 09:31:26.368: WARN/Ads(31669): loadAd called while the ad is already loading, so aborting.
    3.  
    Green (Info):
    Code (Text):
    1.  
    2. 09-14 09:31:27.157: INFO/Ads(31669): onFailedToReceiveAd(Ad request successful, but no ad returned due to lack of ad inventory.)
    3. 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>
    4. 09-14 09:31:40.127: INFO/Ads(31669): onFailedToReceiveAd(Ad request successful, but no ad returned due to lack of ad inventory.)
    5.  
     
  5. Pabrick

    Pabrick Newbie
    Thread Starter
    Rank:
    None
    Points:
    36
    Posts:
    12
    Joined:
    Sep 5, 2011

    Sep 5, 2011
    12
    2
    36
    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 (Text):
    1.  
    2. 09-14 09:41:42.658: ERROR/Ads(31921): Could not get currentAdManager.
    3. 09-14 09:41:42.658: ERROR/Ads(31921): Could not get currentAdManager.
    4.  
     
  6. qasimValent

    qasimValent Member
    Rank:
    None
    Points:
    16
    Posts:
    39
    Joined:
    Jun 29, 2010

    Jun 29, 2010
    39
    6
    16
    RG
    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
     
  7. qasimValent

    qasimValent Member
    Rank:
    None
    Points:
    16
    Posts:
    39
    Joined:
    Jun 29, 2010

    Jun 29, 2010
    39
    6
    16
    RG
    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
     
    Pabrick likes this.
  8. Pabrick

    Pabrick Newbie
    Thread Starter
    Rank:
    None
    Points:
    36
    Posts:
    12
    Joined:
    Sep 5, 2011

    Sep 5, 2011
    12
    2
    36
    Thanks qasimValent

    They are working now!

    I have another problem now, but it's about the killing process of the app.
     
  9. qasimValent

    qasimValent Member
    Rank:
    None
    Points:
    16
    Posts:
    39
    Joined:
    Jun 29, 2010

    Jun 29, 2010
    39
    6
    16
    RG
    Well if you need more help fire away
     
    Pabrick likes this.

Share This Page

Loading...