2

I followed this guide https://developers.google.com/admob/android/native/mute-this-ad

I used this code from github googlesamples too mute a Native Ad.

https://github.com/googlesamples/android-ads/blob/master/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/AdMobCustomMuteThisAdFragment.java

But how can i get the same dialog as in the first image? Now i'm getting a simple dialog with the reasons.

This is what i want

enter image description here

This is what i have now after following the guide and using code from googlesamples

enter image description here

Vince VD
  • 1,506
  • 17
  • 38

2 Answers2

0

The GoogleSamples provides only the way to implement the Mute Ad option. Not the UI.

From their example, you only received default short labels (as "Inappropriate", "Repetitive"...) and use android.R.layout.simple_list_item_1 which is the default list item with only a TextView widget. As the first picture, in production they should use custom strings with their own user interface. According to the documentation you linked:

The implementation of the custom mute interface is entirely up to you. You can place a small close button on the ad, or you can provide some other interface for the user to opt to mute the ad.

The solution might be to map the reasons with your own labels in MuteThisAdReasonWrapper into toString(), and use a custom list item instead of simple_list_item_1.

Blo
  • 11,903
  • 5
  • 45
  • 99
  • But what i want is the default google form with the reasons. As you can see in the first image the blue X close button i don't get that even when i remove setRequestCustomMuteThisAd(true). But i searched everywhere for the default implementation but can only find the one for a custom mute. – Vince VD Nov 19 '19 at 15:30
  • Did you set it to setRequestCustomMuteThisAd(false) and then check nativeAd.isCustomMuteThisAdEnabled() whether its getting set , So that you can confirm that its not enabled. – redhatvicky Nov 23 '19 at 17:14
0

Did you set it to setRequestCustomMuteThisAd(false) and then check nativeAd.isCustomMuteThisAdEnabled() whether its getting set , So that you can confirm that its not enabled.

Moreover check once, If you are building the adloader after you set it to false .

adLoader = new AdLoader.Builder(context, "ad unit ID").withNativeAdOptions(new NativeAdOptions.Builder()
                         .setRequestCustomMuteThisAd(true)
                         .build()).build();
    adLoader.loadAd(new AdRequest.Builder().build());
redhatvicky
  • 1,912
  • 9
  • 8
  • default value for setRequestCustomMuteThisAd is always false if not set, but i don't want to use a custom mute dialog. I want the one you can see in the first image, the ui provided by google. – Vince VD Nov 24 '19 at 05:26