1

I am working on an app and placed some native ads. All things are working fine but code is not show Adchoice icon i tried with different side value but still not working and is it mandatory to use adchoice icon for native ads or i can just leave it .................

//Admob Ads
implementation 'com.google.android.gms:play-services-ads:20.2.0'


   //Nativ ads Code
   object NativeAds {


fun intializeNativeAds(context: Context, unitId: String, template: TemplateView): AdLoader{


    val videoOptions = VideoOptions.Builder()
        .setStartMuted(false)
        .build()

    val adOptions = NativeAdOptions.Builder()
        .setVideoOptions(videoOptions)
        .setRequestCustomMuteThisAd(true)
        .setAdChoicesPlacement(ADCHOICES_TOP_RIGHT)
        .build()

    val adLoaded = AdLoader.Builder(context, unitId).forNativeAd {
       val nativeAds  =  it

     val   mediaContent = nativeAds.mediaContent

        if(mediaContent!=null  && mediaContent.hasVideoContent()){

            println("Vide is availble ")

            mediaContent.videoController.videoLifecycleCallbacks = object : VideoController.VideoLifecycleCallbacks(){

                override fun onVideoStart() {
                    super.onVideoStart()

                println("Started ")
                }

                override fun onVideoPlay() {
                    super.onVideoPlay()
                println("Play ")
                }

                override fun onVideoPause() {
                    super.onVideoPause()
                }

                override fun onVideoEnd() {
                    super.onVideoEnd()
                }
            }


        }


       template.setNativeAd(nativeAds)


    }.withNativeAdOptions(adOptions).withAdListener(object : AdListener(){
        override fun onAdFailedToLoad(loadError: LoadAdError) {
            println("Failure to Load "+ loadError.message )
        }
    })
    return adLoaded.build()
}

}

2 Answers 2

3

If your implementation is correct the adChoices will be shown in case you have a real advertisement and not during the tests. You will simply have to publish the app, use the correct and non-test codes and you will see that it will appear

3

Ad_choices_icon is automatically added by Admob, you don't have to add it. You can only change its position.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.