NativeBannerAd
in the Unity SDK 4.99 release. NativeBannerAd
is used for showing a native ad without the ad image or video. In a native banner ad, ad icon, ad title, ad CTA button, and ad choices icon are still required to be shown to users.
If using NativeBannerAd
, you will need to select the 'Native banner' format for your placement in Monetization Manager. If you are updating from NativeAd
to NativeBannerAd
you may continue to use the same placement, but you will need to update the format type.
NativeAd
and NativeBannerAd
interfaces:
New Method | Description |
---|---|
| Get the name of the Facebook Page or mobile app that represents the business running each ad. |
| Get the headline that the advertiser entered when they created their ad. This is usually the ad's main title. |
| Get additional information that the advertiser may have entered. |
| Get the word 'sponsored', translated into the language based upon Facebook app language setting. |
| Get the word 'ad', translated into the language based upon Facebook app language setting. |
| Get the word 'promoted', translated into the language based upon Facebook app language setting. |
In this new release, we have a few APIs that have been changed for better ad quality.
RegisterGameObjectsForInteraction
.
NativeAd
interface changes (notice that NativeBannerAd
shares the same interface): RegisterGameObjectForImpression
is replaced by RegisterGameObject
and is no longer being used for registering objects for impression/interaction. It is still mandatory to call RegisterGameObject before loading an ad.
SetAd
.In this new release, we have removed some APIs for better ad quality.
CoverImageURL
and IconImageURL
are no longer exposed and you don't need to download them separatly from loading the ad. Calling RegisterGameObjectsForInteraction
will present the ad assets.NativeAd
interface removal: LoadCoverImage
is removed.LoadIconImage
is removed.LoadAdChoicesImage
is removed.Remove the older version of Audience Network Android SDK from your Android Studio project and replace with the latest one, downloaded from the downloads page.
Code to load native ad before:
private NativeAd nativeAd; // Create a native ad request with a unique placement ID nativeAd = new AudienceNetwork.NativeAd("YOUR_PLACEMENT_ID"); nativeAd.RegisterGameObjectForImpression(gameObject, new Button[] { callToActionButton }); nativeAd.NativeAdDidLoad = (delegate() { // Download images and show text once ad is loaded StartCoroutine(nativeAd.LoadIconImage(nativeAd.IconImageURL)); StartCoroutine(nativeAd.LoadCoverImage(nativeAd.CoverImageURL)); StartCoroutine(nativeAd.LoadAdChoicesImage(nativeAd.AdChoicesImageURL)); title.text = nativeAd.Title; socialContext.text = nativeAd.SocialContext; callToAction.text = nativeAd.CallToAction; }); ... // Initiate a request to load an ad. nativeAd.LoadAd();
Code to load native ad using Unity 4.99 release:
private NativeAd nativeAd; // Create a native ad request with a unique placement ID nativeAd = new AudienceNetwork.NativeAd("YOUR_PLACEMENT_ID"); nativeAd.RegisterGameObject(gameObject); nativeAd.NativeAdDidLoad = (delegate() { // Register game objects for interactions. MediaView will be used for impression logging. CallToActionButton will be used for click logging. nativeAd.RegisterGameObjectsForInteraction((RectTransform)mediaView.transform, (RectTransform)callToActionButton.transform, (RectTransform)iconImage.transform); advertiserName.text = nativeAd.AdvertiserName; socialContext.text = nativeAd.SocialContext; callToActionButton.text = nativeAd.CallToAction; }); ... // Initiate a request to load an ad. nativeAd.LoadAd();