Android Question [ Admob ] Error 3 to almost 1 week

Waldemar Lima

Well-Known Member
Licensed User
Hello guys, I'm trying to monetize my apps, but I want to see if google starts sending ads, so I can start development so that nothing is too bad ...
I created a signed apk, configured with firebase and etc., compiled and sent it to some friends to come in every day and generate some traffic so that there is a greater possibility for google to send ads , I tested the same google-services.json with the definitive example of admob with b4xpages and all test ads work 100%, but in my old code, I just get the message of test Banner: Error 3

could be a problem with this code?

code :
B4X:
#Region  Project Attributes
    #ApplicationLabel: Samuel App
    #VersionCode: 1
    #VersionName: 1.0
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: True
#End Region
#BridgeLogger: true

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    Private tamanhoBanner As Int
End Sub

Sub Globals
    Private BannerAd As AdView
    Private IAd As InterstitialAd
End Sub

Sub Activity_Create(FirstTime As Boolean)
    
    Activity.Title = "App example"
    
    If IAd.IsInitialized = False Then IAd.Initialize("iad", "ca-app-pub-3940256099942544/1033173712") 'INTERSTICIAL ADMOB

    If IAd.IsInitialized Then IAd.LoadAd
    
    ' THIS BANNER I GET ERROR 3
    If BannerAd.IsInitialized = False Then BannerAd.Initialize2("BannerAd", "ca-app-pub-3940256099942544/6300978111", BannerAd.SIZE_BANNER) 'BANNER ADMOB
    
    If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
        'phones
        If 100%x > 100%y Then tamanhoBanner = 32dip Else tamanhoBanner = 50dip
    Else
        'tablets
        tamanhoBanner = 90dip
    End If
        
    'ADICIONA O BANNER EM BAIXO DA TELA E DEIXA ELE VISIBLE
    Activity.AddView(BannerAd, 0dip, 100%y - tamanhoBanner, 100%x, tamanhoBanner)
    BannerAd.Color = Colors.ARGB(255,255,255,255)
    BannerAd.Visible = True 'POR PADRƃO O BANNER CARREGA COMO VISIBLE TRUE
    If BannerAd.IsInitialized Then
        SetElevation(BannerAd,6dip)
        BannerAd.LoadAd
    End If
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Click
    If IAd.IsInitialized And IAd.Ready Then
        IAd.Show
    End If
End Sub

Sub BannerAd_AdClosed
End Sub

Sub BannerAd_ReceiveAd
    Log("recebi ads banner")
End Sub

Sub BannerAd_FailedToReceiveAd (ErrorCode As String)
    Log("Error : "&ErrorCode)
    Msgbox("Error : "&ErrorCode,"error")
End Sub

Sub BannerAd_adopened
End Sub


Sub SetElevation(v As View, e As Float)
    Dim jo As JavaObject
    Dim p As Phone
  
    If p.SdkVersion >= 21 Then
        jo = v
        jo.RunMethod("setElevation", Array As Object(e))
    End If
End Sub


Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub IAd_AdClosed
End Sub

Sub IAd_FailedToReceiveAd (ErrorCode As String)
    Log("Error : "&ErrorCode)
End Sub

Sub IAd_ReceiveAd
End Sub

Sub IAd_adopened
    
End Sub

Manifest:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>
<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)
'End of default text.
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)

AddReplacement($ADMOB_APP_ID$, ca-app-pub-XXXXXXX)


someone know what can it be ?
 
Top