AdMob Designed for Families Targeting Error - Unity

995 views
Skip to first unread message

Ennesoft

unread,
Mar 1, 2018, 1:04:59 PM3/1/18
to Google Mobile Ads SDK Developers

Dear all,
we've a problem with the implementation of AdMob with the Designed for Families programme.

We are using:


This is the code doesn't work:



       
// Create a 320x50 banner at the top of the screen.
        bannerView
= new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);


       
AdRequest request = new AdRequest.Builder()
           
.TagForChildDirectedTreatment(true)
           
.AddExtra("is_designed_for_families", "true")
           
.AddExtra("max_ad_content_rating", "G")
       
.Build();


This is the error:
                             
           (Filename: /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/egl/ConfigEGL.cpp Line: 376)
03-01 18:29:01.700 5668-5697/? E/Unity: [EGL] eglChooseConfig(m_EGLDisplay, configAttribs, NULL, 0, &eglConfigCount): EGL_BAD_ATTRIBUTE: An unrecognized attribute or attribute value was passed in the attribute list.


If I don't use the AddExtra the code works, but we need to implement the targeting.

Thank you very much in advace for your help.

Kind regards,
Ennesoft Team



mobileadssdk-a...@google.com

unread,
Mar 1, 2018, 2:56:55 PM3/1/18
to Ennesoft, Google Mobile Ads SDK Developers
Hi there,

It looks like this is an implementation issue. Try with the following snippet and see if you are able to make a request.

Bundle extras = new Bundle();
extras.putString("max_ad_content_rating", "G");


AdRequest request = new AdRequest.Builder()
.addNetworkExtrasBundle(AdMobAdapter.class, extras)
.build();

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/b967a7ec-6f40-40cb-8c77-48fd924b3065%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ennesoft

unread,
Mar 1, 2018, 3:50:19 PM3/1/18
to Google Mobile Ads SDK Developers
Dear Deepika,
thank you very much for your help.

I've tried your solution but doesn't work.

The code I've tried:

        Bundle extras = new Bundle();
        extras
.putString("max_ad_content_rating", "G");


       
AdRequest request = new AdRequest.Builder()
       
.addNetworkExtrasBundle(AdMobAdapter.class, extras)
       
.build();


Now the errors are:
  1. The type or namespace Bundle could not be found
  2. AdRequest.Builder does not contain a definition for addNetworkExtrasBundle and no extension method addNetworkExtrasBundle accepting first argument of type AdRequest.Builder could be found
  3. The name AdMobAdapter does not exist in the current context

How can I solve?

Mny thanks in advance.

Best regards,
Ennesoft Team

mobileadssdk-a...@google.com

unread,
Mar 2, 2018, 3:13:21 PM3/2/18
to Ennesoft, Google Mobile Ads SDK Developers
Hi there,

You need to import -

import com.google.ads.mediation.admob.AdMobAdapter;
import com.google.android.gms.ads.AdRequest;
import android.os.Bundle;

to be able to get reference to the above code snippet classes. This will resolve the type or namespace issue for Bundle and AdMobAdapter. Next you must make sure to be on the latest version of the Mobile Ads SDK. This will resolve the addNetworkExtrasBundle issue.


Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.

Ennesoft

unread,
Mar 3, 2018, 1:33:17 AM3/3/18
to Google Mobile Ads SDK Developers
Dear Deepika,

I'm using Unity and the script is in C#.

How can use your import code for import these libraries?

import com.google.ads.mediation.admob.AdMobAdapter;
import com.google.android.gms.ads.AdRequest;
import android.os.Bundle;

It seems to me a more familiar solution to Java dev.

Can you help me?

Mny thank,
Ennesoft Team

mobileadssdk-a...@google.com

unread,
Mar 5, 2018, 3:58:22 PM3/5/18
to Ennesoft, Google Mobile Ads SDK Developers
Hi there,

Thanks for getting back to us. If you are looking for Unity, then you can use this-

AdRequest.Builder().AddExtra("max_ad_content_rating", "G") and it should work. Please send us the complete device logs if you are still not able to resolve the issue.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.

Ennesoft

unread,
Mar 10, 2018, 4:12:04 AM3/10/18
to Google Mobile Ads SDK Developers
Hi Deepika,
thank you so much!

It's seems to be working!  Sounds so good!

Thank u again.

Best regards,
Ennesoft Team
Reply all
Reply to author
Forward
0 new messages