Android Question Google ads

Spright

Active Member
Google ads stopped working yesterday?
I got error code 3, and the requester pops up initilaly and accepting it gets me error code 2 starting yesterday.

How can i fix this code? I was just about to release the app next month. I'm not even aware what is wrong yet.

B4X:
 #MultiDex: True

#Region Project Attributes
    #FullScreen: True
    #IncludeTitle: False
    #ApplicationLabel: Demo
    #VersionCode: 1
    #VersionName:
    #SupportedOrientations: Portrait
    #CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#End Region

#AdditionalJar: com.google.android.ump:user-messaging-platform

Sub Process_Globals
    Private xui As XUI
End Sub

Sub Globals
    Dim GL As lgGL
    Dim lGdx As LibGDX
    Dim IP As lgInputProcessor
    Dim Batch As lgSpriteBatch
    Dim texsheet As lgTexture
    Dim adwanted As Boolean = True
    Dim Surface As View
    Dim tm As Timer
    Dim Camera As lgOrthographicCamera
    Private Ads As AdsHelper
    Private BannerAd As AdView
    Private BannerAdFixedSize As AdView
    Private iAd As InterstitialAd
    Private Ads As AdsHelper
    Private AppOpenAdUnit As String = "ca-app-pub-3940256099942544/3419835294"
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.Color=Colors.Black
    If FirstTime = True Then
        Dim Config As lgConfiguration
        Config.useAccelerometer = False
        Config.useCompass = False
        Config.useWakelock = True
        Config.hideStatusBar = True
        Config.useImmersiveMode = True
        Config.r = 8
        Config.g = 8
        Config.b = 8
        Config.a = 8
        Config.numSamples = 0
        Config.maxSimultaneousSounds = 8
        Surface = lGdx.InitializeView2(Config, "LG")
        Activity.AddView(Surface, 0, 0, 100%x, 100%y)
        tm.Initialize("timer",4000*4)
        tm.Enabled = True
    End If
   
    Dim ButtonPanel As Panel
    ButtonPanel.Initialize("")
    Activity.AddView(ButtonPanel, 0, 250dip, 100%x, 150dip)
    ButtonPanel.LoadLayout("MainPage")
    Ads.Initialize
    CheckConsentAndAddAds
   
    ' OLD ADS
    ' Create the panel view and add it to the activity
'    Dim panel As Panel
'    panel.Initialize("")
'    panel.Color = Colors.White
'    panel.SetLayout(0, 0, 100%x, 90dip)
'    Activity.AddView(panel, 0, 0, 100%x, 90dip)
'    ' Initialize and load the adaptive ad inside the panel
'    Dim size As AdSize = GetAdaptiveAdSize
'    Dim adHeight As Int = size.Height
'    Dim adView As AdView
'    adView.Initialize2("ad", "ca-app-pub-3940256099942544/6300978111", size.Native)
'    panel.Color = Colors.Transparent
'    panel.AddView(adView, 0, 0, size.Width, adHeight)
'    adView.LoadAd

End Sub

Sub Activity_Resume
    Ads.ShowOpenAdIfAvailable(1)
    If lGdx.IsInitialized Then lGdx.Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    If UserClosed Then Ads.Background
    If lGdx.IsInitialized Then lGdx.Pause
End Sub

Sub LG_Create
    Batch.Initialize
    IP.Initialize("IP")
    texsheet.Initialize("sprite.png")
    Camera.Initialize
    Camera.SetToOrtho(False)
End Sub


Sub LG_Render
    GL.glClearColor(0, 0, 1, 1)
    GL.glClear(GL.GL10_COLOR_BUFFER_BIT)
    Camera.Update
    Batch.ProjectionMatrix = Camera.Combined
    Batch.Begin
    Dim X, Y As Int
    For i = 1 To 99
        X = Rnd(0,999)
        Y = Rnd(0,499)
        Batch.DrawTex2(texsheet, X, Y, 100dip, 100dip)
    Next
    Batch.End
End Sub
 
Sub LG_Resume
End Sub

Sub LG_Pause
End Sub

' ADD LG RESIZE

Sub LG_Dispose
    If texsheet.IsInitialized Then texsheet.dispose
    If Batch.IsInitialized Then Batch.dispose
End Sub

Sub IP_TouchDown(ScreenX As Int, ScreenY As Int, Pointer As Int) As Boolean
    Return True
End Sub

Sub ToastMsg_Show(Text As Object)
    ToastMessageShow(Text, True)
End Sub

Sub timer_Tick
    CheckConsentAndAddAds ' okau to allow check after started offline?
    Log("TIMER!")
End Sub

Private Sub CheckConsentAndAddAds
    Dim m As MobileAds
    Wait For (m.Initialize) MobileAds_Ready
    LogColor("After MobileAds_Ready", Colors.Magenta)
    ' m.SetConfigutation(m.CreateRequestConfigurationBuilder(Array("77A04EE40B2AFED2AFC67701365187EC"))) 'optional. Array with test device ids. See unfiltered logs to find correct id.
    ' Ads.ResetConsentStatus
    ' Ads.SetConsentDebugParameters("77A04EE40B2AFED2AFC67701365187EC", True) 'same id as above
    If Ads.GetConsentStatus = "UNKNOWN" Or Ads.GetConsentStatus = "REQUIRED" Then
        Wait For (Ads.RequestConsentInformation(False)) Complete (Success As Boolean)
    End If
    If Ads.GetConsentStatus = "REQUIRED" And Ads.GetConsentFormAvailable Then
        Wait For (Ads.ShowConsentForm) Complete (Success As Boolean)
    End If
    Log("Consent: " & Ads.GetConsentStatus)
    LoadAds
End Sub

Sub LoadAds
    Dim AdaptiveSize As Map = Ads.GetAdaptiveAdSize
    ' AdaptiveSize.Get("native")
    ' load a fixed size banner ad
    BannerAdFixedSize.Initialize2("BannerAdFixedSize", "ca-app-pub-3940256099942544/6300978111", BannerAd.SIZE_IAB_MRECT)
    Activity.AddView(BannerAdFixedSize, (100%x-300dip)/2, 0, 300dip, 250dip)
    BannerAdFixedSize.LoadAd
   
    BannerAd.Initialize2("BannerAd", "ca-app-pub-3940256099942544/6300978111", AdaptiveSize.Get("native"))
    Activity.AddView(BannerAd, 0, 100%y-AdaptiveSize.Get("height"), AdaptiveSize.Get("width"), AdaptiveSize.Get("height"))
    BannerAd.LoadAd
   
    iAd.Initialize("iad", "ca-app-pub-3940256099942544/1033173712")
    iAd.LoadAd
   
    Ads.FetchRewardedInterstitialAd("ca-app-pub-3940256099942544/5354046379", Me, "RewardedInterstitialAd")
    Ads.FetchRewardedVideoAd("ca-app-pub-3940256099942544/5224354917", Me, "RewardAd")
    Ads.FetchOpenAd(AppOpenAdUnit, Me, "OpenAd")
End Sub

#Region Button Click Events
Private Sub Button1_Click
    If iAd.Ready Then
        iAd.Show
    Else
        Log("no Iad is available")
    End If
    iAd.LoadAd
End Sub

Private Sub Button2_Click
    If Ads.isAvailableRewardedInterstitialAd Then
        Ads.ShowRewardedInterstitialAd
    Else
        Log("wait... loading reward ad")
        Ads.FetchRewardedInterstitialAd("ca-app-pub-3940256099942544/5354046379", Me, "RewardedInterstitialAd")
    End If
End Sub

Private Sub Button_Native_Click
    ' B4XPages.ShowPage("B4XNative2")
    StartActivity(NativeActivity)
End Sub

Private Sub Button_RewardedVideo_Click
    If Ads.isAvailableRewardedVideoAd Then
        Ads.ShowRewardedVideoAd
    Else
        Log("wait... loading reward ad")
        Ads.FetchRewardedVideoAd("ca-app-pub-3940256099942544/5224354917", Me, "RewardAd")
    End If
End Sub
#End Region

#Region Ad Events
Sub BannerAd_ReceiveAd
    Log("BannerAd_ReceiveAd")
End Sub

Sub BannerAd_FailedToReceiveAd (ErrorCode As String)
    Log("BannerAd_FailedToReceiveAd ErrorCode=" & ErrorCode)
End Sub

Sub BannerAd_AdClosed
    Log("BannerAd_AdClosed")
End Sub

Sub BannerAd_AdOpened
    Log("BannerAd_AdOpened")
End Sub

Sub BannerAdFixedSize_ReceiveAd
    Log("BannerAdFixedSize_ReceiveAd")
End Sub

Sub BannerAdFixedSize_FailedToReceiveAd (ErrorCode As String)
    Log("BannerAdFixedSize_FailedToReceiveAd ErrorCode=" & ErrorCode)
End Sub

Sub BannerAdFixedSize_AdClosed
    Log("BannerAdFixedSize_AdClosed")
End Sub

Sub BannerAdFixedSize_AdOpened
    Log("BannerAdFixedSize_AdOpened")
End Sub

Sub iAd_ReceiveAd
    Log("IAd received. Now wait for the right moment to show the ad.")
End Sub

Sub iAd_FailedToReceiveAd (ErrorCode As String)
    Log("Failed: " & ErrorCode)
End Sub

Sub iAd_AdClosed
    Log("Closed")
End Sub

Sub iAd_AdOpened
    Log("Opened")
End Sub

' Open Ad Events
Sub OpenAd_ReceiveAd
    LogColor($"OpenAd_ReceiveAd"$, Colors.Green)
End Sub

Sub OpenAd_FailedToReceiveAd (ErrorCode As String)
    LogColor($"OpenAd_FailedToReceiveAd ErrorCode=${ErrorCode}"$, Colors.Green)
End Sub

' Rewarded video ad events
Sub RewardAd_ReceiveAd
    LogColor($"RewardAd_ReceiveAd"$, Colors.Green)
End Sub

Sub RewardAd_FailedToReceiveAd (ErrorCode As String)
    LogColor($"RewardAd_FailedToReceiveAd ErrorCode=${ErrorCode}"$, Colors.Green)
End Sub

Sub RewardAd_Rewarded (Item As Object)
    LogColor("RewardAd_Rewarded",Colors.Green)
    Dim Reward As JavaObject = Item
    Dim Amount As Int = Reward.RunMethod("getAmount", Null)
    Dim RewardType As String = Reward.RunMethod("getType", Null)
    Log("Rewarded: " & Amount & " -> " & RewardType)
End Sub

' Rewarded interstitial events
Sub RewardedInterstitialAd_ReceiveAd
    LogColor($"RewardInterstitialAd_ReceiveAd"$, Colors.Green)
End Sub

Sub RewardedInterstitialAd_FailedToReceiveAd (ErrorCode As String)
    LogColor($"RewardedInterstitialAd_FailedToReceiveAd ErrorCode=${ErrorCode}"$, Colors.Green)
End Sub

Sub RewardedInterstitialAd_Rewarded (Item As Object)
    LogColor("RewardedInterstitialAd_Rewarded",Colors.Green)
    Dim Reward As JavaObject = Item
    Dim Amount As Int = Reward.RunMethod("getAmount", Null)
    Dim RewardType As String = Reward.RunMethod("getType", Null)
    Log("Rewarded: " & Amount & " -> " & RewardType)
End Sub

#End Region
 

Attachments

  • ModernAds.zip
    30.2 KB · Views: 53

asales

Expert
Licensed User
Longtime User
Worked here!

1694715072161.png
1694715079559.png
 
Upvote 0

Spright

Active Member
Well it have worked for me too for a few months until yesterday. Now when I saw yours I tried again to see if Gogole started the service but no.

This si full a demo units so I dont understand why it doe snot work. I have B4A 12.50 and it's working fine except the ads.
 
Upvote 0

Spright

Active Member
Noone know what is wrong? Do i need tto update something SDK or something like that? I don't understand what i am missing.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
- As you see above, I run your code and worked fine.

- I use the recommend SDK.

- Did you restart the device? I get this behaviour (code 2) sometimes in a Redmi 9A.

- Check the unfiltered logs.

- Check if the app-ads.txt is OK in the Admob console.
 
Upvote 0

Spright

Active Member
This is what I got after reinstalling everything from scratch today, and I still got the same. I think I had the last, by the way, but now I did not want to miss anything.

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
sensor listener setup
OGL renderer: Mali-T720
OGL vendor: ARM
OGL version: OpenGL ES 3.1 v1.r15p0-00rel0.bdd9e62cdc8c88e0610a16b5901161e9
OGL extensions: GL_EXT_debug_marker GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth24 GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_EXT_read_format_bgra GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_image_external_essl3 GL_OES_EGL_sync GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_required_internalformat GL_OES_vertex_array_object GL_OES_mapbuffer GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_type_2_10_10_10_REV GL_OES_fbo_render_mipmap GL_OES_element_index_uint GL_EXT_shadow_samplers GL_OES_texture_compression_astc GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_hdr GL_KHR_texture_compression_astc_sliced_3d GL_KHR_debug GL_EXT_occlusion_query_boolean GL_EXT_disjoint_timer_query GL_EXT_blend_minmax GL_EXT_discard_framebuffer GL_OES_get_program_binary GL_OES_texture_3D GL_EXT_texture_storage GL_EXT_multisampled_render_to_texture GL_OES_surfaceless_context GL_OES_texture_stencil8 GL_EXT_shader_pixel_local_storage GL_ARM_shader_framebuffer_fetch GL_ARM_shader_framebuffer_fetch_depth_stencil GL_ARM_mali_program_binary GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT_texture_sRGB_decode GL_EXT_texture_sRGB_R8 GL_EXT_texture_sRGB_RG8 GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_OES_texture_storage_multisample_2d_array GL_OES_shader_image_atomic GL_EXT_robustness GL_EXT_shader_non_constant_global_initializers GL_EXT_texture_border_clamp GL_OES_texture_border_clamp GL_EXT_texture_cube_map_array GL_OES_texture_cube_map_array GL_OES_sample_variables GL_OES_sample_shading GL_OES_shader_multisample_interpolation GL_EXT_shader_io_blocks GL_OES_shader_io_blocks GL_EXT_gpu_shader5 GL_OES_gpu_shader5 GL_EXT_texture_buffer GL_OES_texture_buffer GL_EXT_copy_image GL_OES_copy_image
framebuffer: (8, 8, 8, 8)
depthbuffer: (24)
stencilbuffer: (0)
samples: (0)
coverage sampling: (false)
Managed meshes/app: { }
Managed textures/app: { }
Managed shaders/app: { }
Managed buffers/app: { }
After MobileAds_Ready
onConsentInfoUpdateSuccess
consent form dismissed
Consent: OBTAINED
Failed: {
"Code": 3,
"Message": "No fill.",
"Domain": "com.google.android.gms.ads",
"Cause": "null",
"Response Info": {
"Response ID": "null",
"Mediation Adapter Class Name": "",
"Adapter Responses": [],
"Response Extras": {}
}
}
Failed to load RewardedInterstitialAd: {
"Code": 3,
"Message": "No fill.",
"Domain": "com.google.android.gms.ads",
"Cause": "null",
"Response Info": {
"Response ID": "null",
"Mediation Adapter Class Name": "",
"Adapter Responses": [],
"Response Extras": {}
}
}
RewardedInterstitialAd_FailedToReceiveAd ErrorCode={
"Code": 3,
"Message": "No fill.",
"Domain": "com.google.android.gms.ads",
"Cause": "null",
"Response Info": {
"Response ID": "null",
"Mediation Adapter Class Name": "",
"Adapter Responses": [],
"Response Extras": {}
}
}
BannerAdFixedSize_FailedToReceiveAd ErrorCode={
"Code": 3,
"Message": "No fill.",
"Domain": "com.google.android.gms.ads",
"Cause": "null",
"Response Info": {
"Response ID": "null",
"Mediation Adapter Class Name": "",
"Adapter Responses": [],
"Response Extras": {}
}
}
Failed to load OpenAd: {
"Code": 3,
"Message": "No fill.",
"Domain": "com.google.android.gms.ads",
"Cause": "null",
"Response Info": {
"Response ID": "null",
"Mediation Adapter Class Name": "",
"Adapter Responses": [],
"Response Extras": {}
}
 
Last edited by a moderator:
Upvote 0

Spright

Active Member
Thanks. But I use the demo id's correct? I'm supposed to have just Googles test ID's in there so I hope i did not show any otherl ID's. Why I ask this is becuase why should demo ID's not be available, and how can you test without them? I se that I get error about the speed too eventually. I think I need to slow down the test code.
 
Upvote 0

Spright

Active Member
Okay, I thought test ads was there 24/7 available to hel you develop the design of your app/game, I have waited for my test ads in 4 days no without them coming back.
 
Upvote 0

Spright

Active Member
Thanks for hep but the problem was truly not solvable. I will levae the plan o use Admob behind as it have stopped working for good on htis end. I cannot find the problem, I bevleie it is a technical issue that I simply have no control over wihtout understanding JAVA.
 
Upvote 0
Top