Skip to main content

Ad Mute

Ad Mute Event

NAM SDK supports to mute ad for banner, native simple types. The callback function for the Ad Mute event has been added.

  1. When calling a banner ad through GfpBannerAdView, transmit the callback through onAdMuted() defined in BannerAdListener.
bannerAdView.setAdListner(object : BannerAdListener() {

/* onAdLoaded(), onAdClicked(), ... */

override fun onAdMuted(ad: GfpBannerAd) {
/* ... */
}
})
  1. When calling banner and native ads through GfpAdLoader, transmit the callback through onAdMuted() defined in AdEventListener.
val adLoader = GfpAdLoader.Builder(activity, adParam)
.withAdListener(object: AdEventListener() {

/* onAdClicked(), onAdImpression(), ... */

override fun onAdMuted() {
/* ... */
}
})
.withNativeSimpleAd(nativeSimpleAdOptions) { nativeSimpleAd ->
/* ... */
}
.build()


Dark Theme

Dark mode/light mode settings are available for the Ad Mute icon.

There are three available types: SYSTEM, which follows the system settings; LIGHT, which is the light mode; and DARK, which is the dark mode.

There are two themes for the settings: global setting using NdaProviderOptions and individual setting using GfpNativeSimpleAdOptions.

1. Global setting

  • Set NdaProviderOptions through SdkProperties
GfpSdk.setSdkProperties(GfpSdk.getSdkProperties().buildUpon()
.addProviderOptions(new NdaProviderOptions.Builder()
.setTheme(ResolvedTheme.SYSTEM).build())
.build());
  • When using the global settings, the settings will be applied to all S2S banner ads and NativeSimple ads for which no individual settings have been made.
  • Without a setup, the default is LIGHT.

2. Individual setting

  • Set through the GfpNativeSimpleAdoption object that is transmitted when an ad request is made through GfpAdLoader.
val nativeSimpleAdOptions = GfpNativeSimpleAdOptions.Builder()
.setTheme(ResolvedTheme.DARK)
.build()

val adLoader = GfpAdLoader.Builder(activity, adParam)
.withAdListener(object: AdEventListener {
/* onAdClicked(), onAdImpression(), ... */

override fun onAdMuted() {
/* ... */
}
})
.withNativeSimpleAd(nativeSimpleAdOptions) { nativeSimpleAd ->
/* ... */
}
.build()

Individual settings take precedence over global settings. Therefore, and global and individual settings both exist, the individual settings will be applied.

3. LazyTheme

LazyTheme is supported from version 6.1.1.

If a theme has not been applied on a screen where theme settings, such as dark mode settings, dynamically change, try applying the LazyTheme below.

The example below is based on native ad standards.

val nativeAdOptions = GfpNativeAdOptions.Builder()
.setHasMediaView(true)
.setTheme(LazyTheme {
when {
caseSystem -> ResolvedTheme.SYSTEM
caseDark -> ResolvedTheme.DARK
else -> ResolvedTheme.LIGHT
}
})
.build()

val adLoader = GfpAdLoader.Builder(requireActivity(), adParam)
.withNativeAd(nativeAdOptions) { nativeAd ->
inflateAd(nativeAd)
}
.build()