AATKit Android Integration
Release Notes
  • Start
    • Setup
      • Maven
      • Prerequisites
      • Google Family Safe Apps
    • Initialization
    • Consent
      • General Handling
      • Managed Consent
        • Google CMP
        • Sourcepoint CMP
        • SFBX (AppConsent) CMP
      • Vendor Consent
      • Simple Consent
    • Plugins documentation
    • Additional Information
  • Formats
    • Introduction
    • Banner
      • Auto Load Banner
      • Multi-Size Auto Load Banner
      • Banner Cache
      • Infeed Banner
      • Sticky Banner
      • Multi-Size Banner
    • Fullscreen (Interstitial)
    • AppOpen (Google)
    • Rewarded Video
      • Server-Side Verification (SSV)
    • Native Ad
      • Basic Integration
      • Network Specifics
        • Native Ads: Google
        • Native Ads: ApplovinMax
        • Native Ads: Bluestack
        • Native Ads: FacebookAudienceNetwork
        • Native Ads: Huawei
  • Ad Networks
    • Customize Ad Networks
    • Google Mobile Ads SDK
    • AppLovinMax Ad Review
    • AppNexus special settings
    • FeedAd Shutter Colour and Disabling Spinner
    • Kidoz
  • Advanced
    • Targeting
      • Key-Value Targeting
      • User Targeting
      • Content Targeting URL
    • Frequency Capping
    • Advanced Listeners
      • Reports Delegate
      • Impression Listener (ILRD)
      • Statistics Listener
    • AATKit's Size
    • Ad Space and Fill Rate
    • Shake Debug
    • Child-directed Support
    • Geo Tracking
    • Disabling Ad Networks
    • Huawei Support
    • Creatives History
  • Other
    • AdMob Custom Events
    • Reference
      • Classes
        • AATKit
        • AATKitUserTargeting
        • CollapsibleBannerOptions
        • AATKitDebugScreenConfiguration
        • PlacementDebugInfo
        • AATKitDebugInfo
        • AATKitConfiguration
        • AATKitRuntimeConfiguration
        • ManagedConsent
        • VendorConsent
        • SimpleConsent
        • BannerConfiguration
        • BannerRequest
        • BannerCacheConfiguration
        • AATKitReward
        • NativeAdRating
        • AATKitImpression
        • PriceInfo
        • AdInfo
        • RewardedAdSSVInfo
        • PlacementHistoryInfo
        • AATKitAdNetworkOptions
          • SuperAwesomeOptions
          • FeedAdOptions
          • AppNexusOptions
          • AdMobOptions
          • DFPOptions
      • Interfaces
        • CacheStatusDelegate
        • AATKit.Delegate
        • BannerCache
        • BannerRequestCompletionListener
        • ManagedConsentDelegate
        • VendorConsentDelegate
        • Placement
        • StickyBannerPlacement
        • StickyBannerPlacementListener
        • MultiSizeBannerPlacement
        • MultiSizeBannerPlacementListener
        • InfeedBannerPlacement
        • InfeedBannerPlacementListener
        • BannerRequestDelegate
        • CacheDelegate
        • FullscreenPlacement
        • FullscreenPlacementListener
        • AppOpenAdPlacement
        • AppOpenPlacementListener
        • RewardedVideoPlacement
        • RewardedVideoPlacementListener
        • NativeAdPlacement
        • NativePlacementListener
        • NativeAdData
        • AutoLoadBannerPlacement
        • AutoLoadBannerPlacementListener
        • AutoLoadMultiSizeBannerPlacement
        • AutoLoadMultiSizeBannerPlacementListener
        • ReportsDelegate
        • ImpressionListener
        • StatisticsListener
      • Enumerations
        • AATKitGender
        • AdNetwork
        • ManagedConsentState
        • NonIABConsent
        • BannerPlacementSize
        • BannerSize
        • MediationType
        • ImpressionPricePrecisionType
  • Samples
Powered by GitBook
On this page
  1. Formats
  2. Native Ad
  3. Network Specifics

Native Ads: Huawei

Integrate native ads (Huawei)

NativeView

  • Native ad assets of Huawei SDK are required to be encapsulated within a parent view of a specific type com.huawei.hms.ads.nativead.NativeView.

  • The same view must be passed to AATKit via the NativeAdData method: attachToLayout.

Also, Huawei displays the native ad main image using an instance of com.huawei.hms.ads.nativead.MediaView.

private com.huawei.hms.ads.nativead.NativeView containerView;
private TextView titleView;
private TextView descriptionView;
private com.huawei.hms.ads.nativead.MediaView mediaView;
private ImageView iconView;
private TextView ctaView;
private var containerView: com.huawei.hms.ads.nativead.NativeView? = null
private var titleView: TextView? = null
private var descriptionView: TextView? = null
private var mediaView: com.huawei.hms.ads.nativead.MediaView? = null
private var iconView: ImageView? = null
private var ctaView: TextView? = null

Bind Huawei Native Ad Assets

After getting a native ad from the NativeAdPlacement, you can follow this code example to bind the native ad assets:

private void setupHuaweiAd(NativeAdData nativeAd) {
    // TODO: create the container view and subviews from layout file

    // Title
    containerView.setTitleView(titleView);
    titleView.setText(nativeAd.getTitle());

    // Ad Icon
    containerView.setIconView(iconView);
    loadImage(iconView, nativeAd.getIconUrl());

    // Body
    containerView.setAdSourceView(descriptionView);
    descriptionView.setText(nativeAd.getDescription());

    // MediaView
    containerView.setMediaView(mediaView); //Huawei SDK will fill the passed MediaView automatically

    // CallToAction
    containerView.setCallToActionView(ctaView);
    ctaView.setText(nativeAd.getCallToAction());

    nativeAd.attachToLayout(containerView, mediaView, iconView, ctaView);
}
private fun setupHuaweiAd(nativeAd: NativeAdData) {
    // TODO: create the container view and subviews from layout file

    // Title
    containerView.setTitleView(titleView)
    titleView.text = nativeAd.title

    // Ad Icon
    containerView.setIconView(iconView)
    loadImage(iconView, nativeAd.iconUrl)

    // Body
    containerView.setAdSourceView(descriptionView)
    descriptionView.text = nativeAd.description

    // MediaView
    containerView.setMediaView(mediaView) //Huawei SDK will fill the passed MediaView automatically

    // CallToAction
    containerView.setCallToActionView(ctaView)
    ctaView.text = nativeAd.callToAction
    
    nativeAd.attachToLayout(containerView, mediaView, iconView, ctaView)
}

Last updated 2 years ago