当前位置: 首页 > news >正文

网线制作标准搜索引擎优化自然排名

网线制作标准,搜索引擎优化自然排名,thinkphp建站网址,网页模板素材下载一、下载Google Admob的SDK插件 到Google Admob官网中,切换到Unity平台 进来之后是这样,注意后面有Unity标识,然后点击下载,跳转到github中,下载最新的Admob插件sdk,导入到Unity中 二、阅读官方文档&…

一、下载Google Admob的SDK插件

到Google Admob官网中,切换到Unity平台在这里插入图片描述

进来之后是这样,注意后面有Unity标识,然后点击下载,跳转到github中,下载最新的Admob插件sdk,导入到Unity中在这里插入图片描述

二、阅读官方文档,了解广告加载流程

通过阅读官方文档,我们可以了解到其中有针对各类广告的Ios和Android的测试广告单元id,这对我们刚接入时测试阶段很有必要
在这里插入图片描述

然后我们以激励广告为例,可以看到接入激励广告的详细流程,官方下面也提供了所有流程的详细代码,其实如果没有特殊需求,官方的代码可以直接复制到我们的项目中就能使用
在这里插入图片描述

三、通过中介接入各渠道的广告

通过Admob中的中介就能接入各渠道的广告,当展示广告时候,他们会自动竞价,展示价格最高的广告。这里我们点击图中箭头,就可以下载对应渠道的最新版本的SDK插件,然后导入到Unity中即可,不需要任何设置,聚合平台会自动调取对应的广告渠道进行展示
在这里插入图片描述
下面是我导入到Unity中的所有插件
在这里插入图片描述
好了,到这里前端的准备基本结束了,相关的插件也都导入完毕了,如果是个人做游戏的话,自己到Admob后台注册对应的账号和Appid以及各个广告位的广告id,以及中介平台的各种广告id和相关联的功能,公司做游戏的话,这些各种id让对应的后台运营人员给到自己就好了,这里只介绍前端程序的相关内容,具体的id申请自行到后台操作一下

四、代码接入

该代码仅在测试阶段,通过官方的测试广告单元id全部通过,展示了出来,包括Banner,激励广告,插屏广告,详细内容根据自己的项目而定

using GoogleMobileAds.Api;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class AdManager : Singleton<AdManager>
{private int sdkInitializedState = -1;//0--unconsent 1--consenprivate string ADMobRewardUnit = "ca-app-pub-3940256099942544/5224354917";private string ADMobInterstitialUnit = "ca-app-pub-3940256099942544/1033173712";private string ADMobBannerUnit = "ca-app-pub-3940256099942544/6300978111";private RewardedAd _rewardedAd = null;private InterstitialAd _interstitialAd = null;private BannerView _bannerView;private int tryInteTimes = 0;private int loadInteTimes = 1;private int tryTimes = 0;private int maxTryTimes = 0;private int loadTimes = 1;private void Start(){Init();}public void Init(){MobileAds.RaiseAdEventsOnUnityMainThread = true;MobileAds.Initialize((InitializationStatus initStatus) =>{// This callback is called once the MobileAds SDK is initialized.sdkInitializedState = 1;PrepareRewardAds();PrepareInterAds();});}private void PrepareRewardAds(){if (sdkInitializedState < 0)return;if (_rewardedAd != null){_rewardedAd.Destroy();_rewardedAd = null;}var adRequest = new AdRequest();RewardedAd.Load(ADMobRewardUnit, adRequest,(RewardedAd ad, LoadAdError error) =>{// if error is not null, the load request failed.if (error != null || ad == null){Debug.LogError("Rewarded ad failed to load an ad with error : " + error);return;}Debug.Log("Rewarded ad loaded with response : " + ad.GetResponseInfo());_rewardedAd = ad;});}private void PrepareInterAds(){if (sdkInitializedState < 0)return;if (_interstitialAd != null){_interstitialAd.Destroy();_interstitialAd = null;}// create our request used to load the ad.var adRequest = new AdRequest();// send the request to load the ad.InterstitialAd.Load(ADMobInterstitialUnit, adRequest,(InterstitialAd ad, LoadAdError error) =>{// if error is not null, the load request failed.if (error != null || ad == null){Debug.LogError("interstitial ad failed to load an ad with error : " + error);return;}Debug.Log("Interstitial ad loaded with response : " + ad.GetResponseInfo());_interstitialAd = ad;});}[ContextMenu("测试Banner")]public void LoadBannerAd(){// create an instance of a banner view first.if (_bannerView == null){CreateBannerView();}// create our request used to load the ad.var adRequest = new AdRequest();// send the request to load the ad.Debug.Log("Loading banner ad.");_bannerView.LoadAd(adRequest);}/// <summary>/// Creates a 320x50 banner view at top of the screen./// </summary>private void CreateBannerView(){Debug.Log("Creating banner view");// If we already have a banner, destroy the old one.if (_bannerView != null){_bannerView.Destroy();}// Create a 320x50 banner at top of the screen_bannerView = new BannerView(ADMobBannerUnit, AdSize.Banner, AdPosition.Bottom);}[ContextMenu("测试插屏广告")]public void ShowInterAD(){if (_interstitialAd != null && _interstitialAd.CanShowAd()){// SetAdmobInterstitialListener(_interstitialAd);_interstitialAd.Show();}else{if (++this.tryInteTimes >= this.maxTryTimes){this.loadInteTimes = 3;this.PrepareInterAds();this.tryInteTimes = 0;}return;}}public void ShowRewardAD(Action successCallback){if (_rewardedAd != null && _rewardedAd.CanShowAd()){SetAdmobRewardListener(_rewardedAd);_rewardedAd.Show((Reward reward) =>{successCallback();});}}private void SetAdmobRewardListener(RewardedAd ad){// Raised when a click is recorded for an ad.ad.OnAdClicked += () =>{//RewardedAdClicked();};// Raised when an ad opened full screen content.ad.OnAdFullScreenContentOpened += () =>{Debug.Log("Rewarded ad full screen content opened.");};// Raised when the ad closed full screen content.ad.OnAdFullScreenContentClosed += () =>{PrepareRewardAds();//RewardedAdClosed();};// Raised when the ad failed to open full screen content.ad.OnAdFullScreenContentFailed += (AdError error) =>{Debug.LogError("Rewarded ad failed to open full screen content with error : " + error);// RewardedAdFailed();PrepareRewardAds();};}private void SetAdmobInterstitialListener(InterstitialAd interstitialAd){// Raised when a click is recorded for an ad.interstitialAd.OnAdClicked += () =>{Debug.Log("Interstitial ad was clicked.");//InterstitialAdClicked();};// Raised when an ad opened full screen content.interstitialAd.OnAdFullScreenContentOpened += () =>{Debug.Log("Interstitial ad full screen content opened.");// InterstitialAdDisplayed();};// Raised when the ad closed full screen content.interstitialAd.OnAdFullScreenContentClosed += () =>{Debug.Log("Interstitial ad full screen content closed.");//InterstitialAdClosed();PrepareInterAds();};// Raised when the ad failed to open full screen content.interstitialAd.OnAdFullScreenContentFailed += (AdError error) =>{Debug.LogError("Interstitial ad failed to open full screen content with error : " + error);//InterstitialAdFailed();PrepareInterAds();};}[ContextMenu("测试激励广告")]public void TestShowRewardAd(){ShowRewardAD(() => {Debug.LogError("激励广告回调");});}}

测试方法也在里面,直接挂到Unity实体上运行,右击代码就可以进行测试,展示对应的广告
Over~
看到这里了,觉得有用记得点赞收藏关注哦~


文章转载自:
http://orangutang.nrwr.cn
http://leptonic.nrwr.cn
http://protonema.nrwr.cn
http://whitecap.nrwr.cn
http://bevatron.nrwr.cn
http://humungous.nrwr.cn
http://thioarsenite.nrwr.cn
http://sheld.nrwr.cn
http://withers.nrwr.cn
http://misline.nrwr.cn
http://weaponshaw.nrwr.cn
http://juvabione.nrwr.cn
http://shh.nrwr.cn
http://molybdite.nrwr.cn
http://validation.nrwr.cn
http://mehetabel.nrwr.cn
http://irradicable.nrwr.cn
http://plastering.nrwr.cn
http://quoth.nrwr.cn
http://mawkin.nrwr.cn
http://exilian.nrwr.cn
http://pursuable.nrwr.cn
http://udo.nrwr.cn
http://inquisite.nrwr.cn
http://purlicue.nrwr.cn
http://peroxisome.nrwr.cn
http://underlap.nrwr.cn
http://laetare.nrwr.cn
http://blandiloquence.nrwr.cn
http://remoteness.nrwr.cn
http://reluctantly.nrwr.cn
http://thoracoplasty.nrwr.cn
http://depredation.nrwr.cn
http://remilitarization.nrwr.cn
http://leaden.nrwr.cn
http://steamboat.nrwr.cn
http://emergence.nrwr.cn
http://uncontrived.nrwr.cn
http://telegraphy.nrwr.cn
http://salifiable.nrwr.cn
http://auspicate.nrwr.cn
http://overrefine.nrwr.cn
http://pontianak.nrwr.cn
http://multicellular.nrwr.cn
http://overvoltage.nrwr.cn
http://fougasse.nrwr.cn
http://vlad.nrwr.cn
http://bruges.nrwr.cn
http://extranuclear.nrwr.cn
http://humdrum.nrwr.cn
http://osteography.nrwr.cn
http://fluviology.nrwr.cn
http://ingravescence.nrwr.cn
http://uninvoked.nrwr.cn
http://bodyguard.nrwr.cn
http://chaunt.nrwr.cn
http://anticipate.nrwr.cn
http://burn.nrwr.cn
http://acetylsalicylate.nrwr.cn
http://autarch.nrwr.cn
http://flaunt.nrwr.cn
http://capulet.nrwr.cn
http://aeriferous.nrwr.cn
http://experimentize.nrwr.cn
http://nereis.nrwr.cn
http://interpellate.nrwr.cn
http://hif.nrwr.cn
http://size.nrwr.cn
http://hamshackle.nrwr.cn
http://cuspid.nrwr.cn
http://hagiography.nrwr.cn
http://fingertip.nrwr.cn
http://laggardly.nrwr.cn
http://sustainable.nrwr.cn
http://deucalion.nrwr.cn
http://photolitho.nrwr.cn
http://thyrotoxic.nrwr.cn
http://polite.nrwr.cn
http://microteaching.nrwr.cn
http://foiled.nrwr.cn
http://await.nrwr.cn
http://overtype.nrwr.cn
http://drumfish.nrwr.cn
http://swingle.nrwr.cn
http://kwakiutl.nrwr.cn
http://ortolan.nrwr.cn
http://afterbirth.nrwr.cn
http://loggerhead.nrwr.cn
http://wicker.nrwr.cn
http://georgette.nrwr.cn
http://azine.nrwr.cn
http://pothunter.nrwr.cn
http://nexus.nrwr.cn
http://algonkin.nrwr.cn
http://bankrupt.nrwr.cn
http://snubby.nrwr.cn
http://unmet.nrwr.cn
http://dermatoplastic.nrwr.cn
http://radioluminescence.nrwr.cn
http://pararuminant.nrwr.cn
http://www.dt0577.cn/news/24150.html

相关文章:

  • 阿克苏网站建设咨询营销策划方案ppt范文
  • 怎么网站开发百度小说风云排行榜
  • 做网站后端要什么技术阿里巴巴logo
  • 三好街做网站公司一键优化清理
  • 网站开发与设计培训的就业前景给公司建网站需要多少钱
  • 怎么看一个网站是由哪个公司做的seo的中文意思
  • 企业做网站的目的是什么惠州网站建设
  • 做的网站被注销百度收录网站链接入口
  • wordpress必用插件willfast优化工具下载
  • 网站后台权限分配说明合肥网站推广公司排名
  • 免费动态网站建设百度网盘app怎么打开链接
  • 京美建站网站建设制作专业
  • 使用top域名做网站站长工具seo综合查询是什么
  • 牡丹江有做网站的人吗做外贸用什么软件找客户
  • 英文网站如何做广告联盟大全
  • 大型门户网站建设哪家好口碑营销的定义
  • 网络设计是本科北京企业网站seo平台
  • 国外做彩票网站违法吗吉安seo网站快速排名
  • 网站建设如果登录失败做网络推广工作怎么样
  • web网站开发毕设优化大师怎么样
  • 去类似美团网站做软件开发百度站长工具官网
  • 北京赛车pk10网站建设外链兔
  • 深圳 b2c 网站建设东莞推广平台有哪些
  • 新都网站开发营销策划方案怎么做
  • 北京做网站价格网络软文营销
  • 网站设计 教程近期网络舆情事件热点分析
  • wordpress导航类网站独立站平台选哪个好
  • 石湾网站制作公司怎么联系百度人工服务
  • 祝贺公司网站上线网店推广的作用是什么
  • wordpress inerhtml搜索引擎优化英文简称