contact me

Search This Blog

Sports

3/Sports/small-col-right

Videos

3/Food/recent-videos

Videos

3/Food/recent-videos

Technology

3/Technology/small-col-left

all vewers

Fashion

3/Fashion/big-col-right

Business

3/Business/big-col-left
using GoogleMobileAds.Api; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class NativeSample : MonoBehaviour { private bool unifiedNativeAdLoaded; private UnifiedNativeAd nativeAd; public GameObject Template; // Use this for initialization void Start () { MobileAds.Initialize("ca-app-pub-2726291437530559~9618014466"); } // Update is called once per frame void Update () { } public void load() { if(nativeAd != null) { nativeAd.Destroy(); } AdLoader loader = RequestNativeAd(); loader.OnUnifiedNativeAdLoaded += HandleUnifiedNativeAdLoaded; loader.OnAdFailedToLoad += HandleUnifiedNativeAdFailed; loader.LoadAd(new AdRequest.Builder().AddTestDevice("E16FA909BF8D7E3902FA940B7D46F87E").Build()); Debug.Log("load!"); } private AdLoader RequestNativeAd() { AdLoader adLoader = new AdLoader.Builder("ca-app-pub-2726291437530559/8229204032") .ForUnifiedNativeAd() .Build(); return adLoader; } private void HandleUnifiedNativeAdFailed(object sender, AdFailedToLoadEventArgs failed) { Debug.Log("HandleUnifiedNativeAdFailed-Message:" + failed.Message); } private void render() { RectTransform iconContainer = (RectTransform)Template.transform.Find("Icon View"); Image iconImage = iconContainer.gameObject.AddComponent(); Texture2D iconTexture = this.nativeAd.GetIconTexture(); iconImage.material.mainTexture = iconTexture; iconContainer.gameObject.AddComponent(); // Register GameObject that will display icon asset of native ad. if (!this.nativeAd.RegisterIconImageGameObject(iconContainer.gameObject)) { Debug.Log("RegisterIconImageGameObject failed!"); } GameObject adChoicesImage = Template.transform.Find("AdChoices/AdChoicesImage").gameObject; adChoicesImage.GetComponent().material.mainTexture = nativeAd.GetAdChoicesLogoTexture(); adChoicesImage.AddComponent(); if (!nativeAd.RegisterAdChoicesLogoGameObject(adChoicesImage)) { Debug.Log("RegisterAdChoicesLogoGameObject failed!"); } if (nativeAd.GetImageTextures().Count > 0) { GameObject mediaView = Template.transform.Find("Media View").gameObject; mediaView.AddComponent(); mediaView.AddComponent().material.mainTexture = this.nativeAd.GetImageTextures()[0]; List imageObjs = new List(); imageObjs.Add(mediaView); nativeAd.RegisterImageGameObjects(imageObjs); } GameObject advertiserName = Template.transform.Find("Advertiser Name").gameObject; advertiserName.AddComponent(); advertiserName.GetComponent().text = nativeAd.GetAdvertiserText(); if (!nativeAd.RegisterAdvertiserTextGameObject(advertiserName)) { Debug.Log("RegisterAdvertiserTextGameObject failed!"); } GameObject social = Template.transform.Find("Social Context").gameObject; social.GetComponent().text = nativeAd.GetHeadlineText(); social.AddComponent(); if (!nativeAd.RegisterAdvertiserTextGameObject(social)) { Debug.Log("RegisterAdvertiserTextGameObject failed!"); } GameObject body = Template.transform.Find("Body").gameObject; body.GetComponent().text = nativeAd.GetBodyText(); body.AddComponent(); if (!nativeAd.RegisterBodyTextGameObject(Template.transform.Find("Body").gameObject)) { Debug.Log("RegisterBodyTextGameObject failed!"); } GameObject actionButton = Template.transform.Find("Call To Action Button").gameObject; actionButton.GetComponentInChildren().text = nativeAd.GetCallToActionText(); actionButton.AddComponent(); if (!nativeAd.RegisterCallToActionGameObject(actionButton)) { Debug.Log("RegisterCallToActionGameObject failed!"); } } private void HandleUnifiedNativeAdLoaded(object sender, UnifiedNativeAdEventArgs args) { Debug.Log("HandleUnifiedNativeAdLoaded!"); this.nativeAd = args.nativeAd; /*Debug.Log("HandleUnifiedNativeAdLoaded:GetIconTexture:" + this.nativeAd.GetIconTexture().width + ", " + this.nativeAd.GetIconTexture().height); Debug.Log("HandleUnifiedNativeAdLoaded:HeadlineText:" + this.nativeAd.GetHeadlineText() ); Debug.Log("HandleUnifiedNativeAdLoaded:GetAdvertiserText:" + this.nativeAd.GetAdvertiserText()); Debug.Log("HandleUnifiedNativeAdLoaded:GetIconTexture:" + this.nativeAd.GetPrice()); Debug.Log("HandleUnifiedNativeAdLoaded:GetStarRating:" + this.nativeAd.GetStarRating());*/ this.unifiedNativeAdLoaded = true; render(); } }

Business

3/Business/big-col-left

Fashion

3/Fashion/big-col-right

Facebook

Recent

3/recent-posts

Comments

3/recent-comments

Photography

3/Photography/post-per-tag

Categories

Nature

3/Nature/post-grid

Comments

3/recent-comments

Main Slider

5/Business/slider-tag

Custom Widget

3/Business/post-per-tag

Recent in Sports

3/Sports/post-per-tag

upload

Music

3/Music/post-grid

Popular Posts

Popular Posts

Read more

Show more

about me

hellow my name is belal.this is my first website .please visit my website

boul song collection

t his is my youtube channel SM Media If you visit my channel you saw man…

Luxury Collection

High Quality Products

Fashion Model Shoot

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod t…

Most Awesome Breathtaking Places

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor…

Going Shopping for New Dress

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod t…

Beauty of Nature

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod t…

Hello world!

Welcome to Theme Freesia Sites . This is your first post. Edit or delete it…

That is All