Android Question Admob Ads (SOLVED)

Discussion in 'Android Questions' started by walterf25, Dec 6, 2018 at 4:46 AM.

  1. walterf25

    walterf25 Well-Known Member Licensed User

    I have implemented Admob ads into one of my apps it's been more than 4 days and I still can't see any ads, is anyone else experiencing this issue? I don't believe I'm missing anything, I have spent hours checking and making sure I followed the implementation instructions and I can't seem to find anything wrong, any ideas?

    Thanks,
    Walter
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    walterf25 likes this.
  3. walterf25

    walterf25 Well-Known Member Licensed User

  4. Erel

    Erel Administrator Staff Member Licensed User

    Do you get the "no fill" error code? Have you checked the unfiltered logs?
     
  5. walterf25

    walterf25 Well-Known Member Licensed User

    I keep getting error code 3, which according to the documentation means there's no inventory, but i would think that after 4 almost 5 days wouldn't be the case anymore.

    Walter
     
  6. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    If it's not working with test ads then there might be an issue with your implementation. AFAIK you should always be able to get a test ad regardless of whether there would normally be a paying ad available (ie: even if you live in the Antarctic!).

    - Colin.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Check the unfiltered logs. There might be more information there.
     
    walterf25 likes this.
  8. eps

    eps Well-Known Member Licensed User

    What sort of ads are you trying to display?

    Do you see any ad requests or impressions in the AdMob or FireBase Consoles?
     
  9. Pendrush

    Pendrush Well-Known Member Licensed User

  10. walterf25

    walterf25 Well-Known Member Licensed User

    I just tried it again with Test Ad units and I can see the ads, I wonder why isn't it showing live ads when I use my personal Test Unit ID.

    Walter
     
  11. walterf25

    walterf25 Well-Known Member Licensed User

    Just regular banner ads.

    Walter
     
  12. walterf25

    walterf25 Well-Known Member Licensed User

    Set up is OK, i just confirmed it by adding a Test Ad ID and it shows up just fine.

    But If i use my created Ad ID it doesn't show anything.

    Walter
     
  13. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    OK - so if you're receiving test ads, then the problem is not in your app. It's either that there are just no ads currently available to be served, or there's an issue with your AdMob account. Have you used AdMob before? If it's a new AdMob account, make sure you have provided your payment information. Apparently you won't get any ads if you haven't.

    If everything looks OK with your account, reach out to AdMob support & they may be able to look into it for you.

    - Colin.
     
    eps likes this.
  14. eps

    eps Well-Known Member Licensed User

    +1 for Payment Information and check the Consoles... Firebase and Admob, they should show something in there, either that no ads have been requested or that at least something has happened etc...
     
  15. walterf25

    walterf25 Well-Known Member Licensed User

    I have checked the unfiltered logs once again, I created another ad unit and have also changed the package name of the application and linked it with firebase, basically I have created a whole new project and have added the new Ad Unit ID to the project and I now see this error in the unfiltered logs.

    Not sure if this indicates that there is in fact an issue, i'm running out of time and started wrapping another Ads library, if I can get Admob to work that would be ideal, but i'm running out of time and patience as well, I have used Admob before and never had this issue.

    Feeling frustrated :mad:

    Walter
     
  16. walterf25

    walterf25 Well-Known Member Licensed User

  17. eps

    eps Well-Known Member Licensed User

    Have you got all the latest libraries and so on? Good WiFi or 4G signal? Any bits of code or library uses you can show us?
     
    walterf25 likes this.
  18. walterf25

    walterf25 Well-Known Member Licensed User

    I am using the latest FireBaseAdmob library version 1.5, i have updated google play services and all of firebase libraries, here's the relevant part of my code

    Manifest entries:
    Code:
    AddManifestText(
    <uses-sdk android:minSdkVersion=
    "5" android:targetSdkVersion="28"/>
    <supports-screens android:largeScreens=
    "true"
        android:normalScreens=
    "true"
        android:smallScreens=
    "true"
        android:anyDensity=
    "true"/>)
    SetApplicationAttribute(android:icon, 
    "@drawable/icon")
    SetApplicationAttribute(android:
    label"$LABEL$")
    '''CreateResourceFromFile(Macro, Themes.DarkTheme)

    SetApplicationAttribute(android:theme, 
    "@style/MyAppTheme")

    CreateResource(values, theme.xml,
    <resources>
        <style name=
    "MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
            <item name=
    "colorPrimary">#0098FF</item>
            <item name=
    "colorPrimaryDark">#0288d1</item>
            <item name=
    "colorAccent">#AAAA00</item>
            <item name=
    "android:navigationBarColor">#0288d1</item>
            <item name=
    "windowNoTitle">true</item>
            <item name=
    "windowActionBar">false</item>
        </style>
    </resources>
    )

    AddPermission(android.permission.ACCESS_COARSE_LOCATION)
    AddPermission(android.permission.ACCESS_FINE_LOCATION)
    AddPermission(android.permission.ACCESS_NETWORK_STATE)
    AddPermission(android.permission.ACCESS_WIFI_STATE)
    AddPermission(android.permission.INTERNET)
    AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)

    CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
    CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
    CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
    CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)
        
    '''Google Maps
        AddApplicationText(
    <meta-data
      android:name=
    "com.google.android.geo.API_KEY"
      android:value=
    "AIzaSyBYHNLaZKLg5bDP7ZVnCglJK-UfbFnXl2A"/>
    )
    And here's the Actual code in my Routes Activity:
    Code:
    Private admob As AdView

    admob.Initialize2(
    "admob""ca-app-pub-3936850409264775/7701061741", admob.SIZE_SMART_BANNER)
        
    Dim height As Int
        
    If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
            
    'phones
            If 100%x > 100%y Then
                 height = 
    32dip
            
    Else
                height = 
    50dip
            
    End If
        
    Else
            
    'tablets
            height = 90dip
        
    End If
        
        pnlAd.AddView(admob, 
    0, pnlAd.Height/2 - height/2100%x, height)
        pnlAd.Top = 
    100%y - 50dip
        pnlAd.Height = height

        admob.LoadAd
    I also have this in the Starter Service to allow the user to give consent to continue using ads.
    Code:
    Sub Service_Create
        
    'This is the program entry point.
        'This is a good place to load resources that are not specific to a single activity.
        consent.Initialize("consent")
        consent.RequestInfoUpdate(
    Array("pub-3936850409264775"))
        
    Log("requesting info update")
        
    Wait For consent_InfoUpdated (Success As Boolean)
        
    If Success = False Then
            
    Log($"Error getting consent state: ${LastException}"$)
        
    End If
        
    Log($"Consent state: ${consent.ConsentState}"$)
        
    Log("EU: " & consent.IsRequestLocationInEeaOrUnknown)
        
    Do While IsPaused(Routes)
            Sleep(
    100)
        
    Loop
        CallSubDelayed(Routes, 
    "ConsentStateAvailable")
    End Sub
    And the ConsentStateAvailable code in the Routes Activity is the following:
    Code:
    Sub ConsentStateAvailable
        
    Dim consent As ConsentManager = Starter.consent
        
    If consent.ConsentState = consent.STATE_UNKNOWN Then ''And consent.IsRequestLocationInEeaOrUnknown
            Dim stu As StringUtils

            
    Dim dialog1 As CustomLayoutDialog

            
    Dim sf As Object = dialog1.ShowAsync("""OK"""""NullFalse)
            
    Wait For (sf) Dialog_Ready (DialogPanel As Panel)
            DialogPanel.LoadLayout(
    "frmAdmobConsens")

            lblAppName.Text = 
    Application.LabelName
            lblInfo1.Text = 
    "This is a Free App and contains ads in order to support the development."
            lblInfo2.Text = 
    "Do we have your permission to continue displaying ads?"
            lblInfo3.Text = 
    "Please make a Selection for " & Application.LabelName & " You can always change your selection in the App Settings"

            lblInfo1.Height = stu.MeasureMultilineTextHeight(lblInfo1, lblInfo1.Text) + 
    10dip
            lblInfo2.Height = stu.MeasureMultilineTextHeight(lblInfo2, lblInfo2.Text) + 
    10dip
            lblInfo3.Height = stu.MeasureMultilineTextHeight(lblInfo3, lblInfo3.Text) + 
    10dip

            lblInfo2.Top = lblInfo1.Top + lblInfo1.Height
            lblInfo3.Top = lblInfo2.Top + lblInfo2.Height
            
            RadioButton1.Top = lblInfo3.Top + lblInfo3.Height
            RadioButton2.Top = RadioButton1.Top + RadioButton1.Height
            RadioButton3.Top = RadioButton2.Top + RadioButton2.Height

            RadioButton1.Text = 
    "Yes, Continue with personalized Ads"
            RadioButton2.Text = 
    "No, I do not want to see personalized Ads"
            RadioButton3.Text = 
    "No, I do not want to see any Ads."
            
            pnlAdmobConsens.Height = 
    10dip + lblAppName.Height + lblInfo1.Height + lblInfo2.Height + lblInfo3.Height + RadioButton1.Height + RadioButton2.Height +         RadioButton3.Height
            dialog1.SetSize(
    100%x80dip + pnlAdmobConsens.Height)
            
            
    Wait For (sf) Dialog_Result (Result As Int)
     
            
    If RadioButton1.Checked Then
                consent.ConsentState = consent.STATE_PERSONALIZED
            
    else if RadioButton2.Checked Then
                consent.ConsentState = consent.STATE_NON_PERSONALIZED
            
    else if RadioButton3.Checked Then
                consent.ConsentState = consent.STATE_UNKNOWN
                
    ExitApplication
            
    End If
            
    'LogColor($"Consent form result: ${consent.ConsentState}"$, Colors.Red)
        End If
        LoadAd
    End Sub

    Sub LoadAd
        
    Dim builder As AdRequestBuilder
        builder.Initialize
        
    Dim consent As ConsentManager = Starter.consent
        
    If consent.IsRequestLocationInEeaOrUnknown Then
            
    If consent.ConsentState = consent.STATE_NON_PERSONALIZED Then
                builder.NonPersonalizedAds
            
    Else if consent.ConsentState = consent.STATE_UNKNOWN Then
                
    Return
            
    End If
        
    End If
        
    ''builder.AddTestDevice("865BF86C54272BFD5EF122E568DC36F2")
        admob.LoadAdWithBuilder(builder)
    End Sub
    And of course I have the subs to handle the adreceived and the failedtoreceiveAd subs:
    Code:
    Sub admob_ReceiveAd
        
    Log("Ad received")
    End Sub

    Sub admob_FailedToReceiveAd (ErrorCode As String)
        
    Log("failed to receive ad: " & ErrorCode)
    End Sub
    Walter
     
  19. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    It's certainly not unheard of for AdMob to release an update to the SDK that breaks previously working ads. I've seen it happen a few times before, so I wonder if this is a bug related to the latest SDK release?

    Having said that, you might want to look at the release notes -> https://developers.google.com/admob/android/rel-notes

    In particular, there is this from AdMob v17.0.0:

    Although it says in the Get Started Guide that failure to ad the APPLICATION_ID will result in a crash on initialization, so this might not be relevant.

    - Colin.
     
  20. walterf25

    walterf25 Well-Known Member Licensed User

    Thanks, i've also added that meta tag in the manifest file but it makes no difference.

    Walter
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice