Android Question admob ads content, google play families policy and the use of tagForChildDirectedTreatment

melonZgz

Active Member
Licensed User
Hello friends.
I have been trying to update one of my games without much success, since Google has rejected my update several times, always claiming the content of the ads. Finally yesterday they removed the game from the store. A game with almost 1M downloads
The problem is that it's a game suitable for children under 13yo, so I must complaint with the families policy thing
They refer me to this: https://support.google.com/admob/answer/6223431
There they suggest to use tagForChildDirectedTreatment() and set the max_ad_content_rating to G (it's at G in my admob console for this game)
After that I saw this post: https://www.b4x.com/android/forum/t...atment-boolean-deprecated.131580/#post-829567 I even asked there but only got adviced to start a new post.
I'm using code from here. As it's a game, It's not a B4Xpages app.
I switched to FirebaseAdMob2 as suggested. The problem I'm facing is that it looks that it does not seem to affect the ads. The reviewers are rejecting my game because of ads content. If the ad they see is from an online shop: rejected. If it's from, let's say, a language school then rejected again.
Here is what I'm doing
B4X:
Sub Activity_Create(FirstTime As Boolean)
    ...
    setAds(False, True) 
End Sub

private Sub setAds
    Dim m As MobileAds
    Wait For (m.Initialize) MobileAds_Ready
    Dim Builder As JavaObject = m.CreateRequestConfigurationBuilder(Array(Null))   
    Builder.RunMethod("setTagForChildDirectedTreatment", Array(1)) 'TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE
    m.SetConfiguration(Builder)       

    IAd.Initialize("iad", "ca-app-pub-xxxxx...")
    IAd.LoadAd
    
End Sub

So what I'm I doing wrong here?
Thanks in advance...
 

melonZgz

Active Member
Licensed User
Thanks, but I'm afraid I'm getting an error here...
B4X:
java.lang.RuntimeException: Method: setTagForChildDirectedTreatment not found in: com.google.android.gms.ads.AdRequest$Builder
    at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:363)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:120)
    at com.ninjagames.hill.main$ResumableSub_addAnuncios.resume(main.java:934)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:207)
    at anywheresoftware.b4a.BA$1.run(BA.java:352)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6923)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)

just out of curiosity. If I make a typo with the code I was using (I'm writing setTagForChildDirectedTreatment2 on purpose to raise an error):

B4X:
MobileAds.Initialize
Dim Builder As JavaObject = MobileAds.CreateRequestConfigurationBuilder(Null)
'https://developers.google.com/android/reference/com/google/android/gms/ads/RequestConfiguration.Builder#public-requestconfiguration.builder-settagforchilddirectedtreatment-int-tagforchilddirectedtreatment
Builder.RunMethod("setTagForChildDirectedTreatment2", Array(1)) 'TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE
MobileAds.SetConfiguration(Builder)

Then the error I get is a bit different:
B4X:
java.lang.RuntimeException: Method: setTagForChildDirectedTreatment2 not found in: com.google.android.gms.ads.RequestConfiguration$Builder
 
Upvote 0

melonZgz

Active Member
Licensed User
Thx Erel... will try and see if it makes effect. BTW, I don't need to call that code in any other moment than in Activity_Create right?
I mean, let's say 8 of 10 adds may be "neutral" (other games ads mainly), but then, after 4 succesfull ads... online shop ad! And if that happens in revision it means rejection.
Just out of curiosity, I've played very popular games (ie crossy Road, of wich I'm making a clone of) and selecting that I'm under 13 I've seen the same ads that made my update rejected.
And now we can add a new problem. As my game has been retired from the store, admob has stopped serving ads! so...
 
Upvote 0
The code on this page: https://support.google.com/admob/answer/6223431 is outdated.

The code in the first post is correct. Add this:
B4X:
Builder.RunMethod("setMaxAdContentRating", Array("G"))
 m.SetConfiguration(Builder)
B4X:
        Dim m As MobileAds
        Wait For (m.Initialize) MobileAds_Ready
        Dim Builder As JavaObject = m.CreateRequestConfigurationBuilder(Array(Null))
        Builder.RunMethod("setTagForChildDirectedTreatment", Array(1)) 
        m.SetConfiguration(Builder)
        Builder.RunMethod("setMaxAdContentRating", Array("G"))
        m.SetConfiguration(Builder)

        iAd.Initialize("iad", "ca-app-pub-XXX")
        iAd.LoadAd

Sorry to ask a silly question - do you mean this?

Loading the ad with this code ensures all the ad loaded will be compliant to the Google family policy?

Thank you.
 
Upvote 0
Top