Interestial Ads Not Showing on Live Android Device for Game Build in Unity 4.6(在 Unity 4.6 中构建游戏的实时 Android 设备上未显示有趣的广告)
问题描述
我正在使用 Unity 版本 ==> 4.6.0
Admob 版本 ==> Google 移动广告 Unity 插件 v3.1.3
I am using Unity Version ==> 4.6.0
Admob Version ==> Google Mobile Ads Unity Plugin v3.1.3
我正在使用下面的代码来展示插页式广告.
I am using below code to show interstitial ads.
public const string adsIdAndroid = "ca-app-pub-3940256099942544/1033173712";
public void RequestInterstitial()
{
try
{
if (!AdsFlag)
{
Debug.Log("Requested Interstitial");
// Initialize an InterstitialAd.
interstitial = new InterstitialAd(adsIdAndroid);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the interstitial with the request.
interstitial.LoadAd(request);
}
}
catch (Exception ex) { }
}
public void ShowInterstitial()
{
try
{
//Debug.Log("Try Show InterstitialAd");
if (!AdsFlag)
{
if (interstitial.IsLoaded())
{
Debug.Log("Show InterstitialAd");
interstitial.Show();
AdsFlag = true;
}
else
{
Debug.Log("InterstitialAd Not Loaded");
RequestInterstitial();
}
}
}
catch (Exception ex) { }
}
我正在调用上面的函数如下:
I am calling above function as below :
void Start()
{
AdsFlag = false;
RequestInterstitial();
}
void Update()
{
ShowInterstitial();
}
Unity 日志如下:
Unity Log As Below :
Requested Interstitial
UnityEngine.Debug:Log(Object)
Dummy CreateInterstitialAd
UnityEngine.Debug:Log(Object)
Dummy LoadAd
UnityEngine.Debug:Log(Object)
Dummy IsLoaded
UnityEngine.Debug:Log(Object)
Show InterstitialAd
UnityEngine.Debug:Log(Object)
Dummy ShowInterstitial
UnityEngine.Debug:Log(Object)
但在真正的 Android 设备上,广告不显示..
如何解决这个问题?
But on Real Android Device , ads not showing up..
How to solve this problem ?
推荐答案
我们中的许多人都面临着与 unity 和 admob 类似的问题
Many of us facing similar problem with unity and admob
我刚刚通过以下步骤解决了这个问题:
I just solved this problem by following below steps:
1) 我删除了 AssetsPluginsAndroid 下的 google-play-services_lib 文件夹2) 然后选择 Menu Assets -> Play Service Resolver -> Android Resolver -> Resolve Client Jars.
1) I have deleted google-play-services_lib folder at AssetsPluginsAndroid 2) Then Select Menu Assets -> Play Service Resolver -> Android Resolver -> Resolve Client Jars.
我只是按照这 2 个步骤操作,现在我的谷歌广告工作正常.也许这个答案可以帮助您找出问题.
I just followed this 2 steps and now my google ads working fine. Maybe this answer help you to figure out problem.
这篇关于在 Unity 4.6 中构建游戏的实时 Android 设备上未显示有趣的广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Unity 4.6 中构建游戏的实时 Android 设备上未显示有趣的广告
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01