PC上运行正常,到了安卓手机上Advertisement.IsReady()一直是FALSE的,老师能否帮忙看下是什么原因
public static void ShowAd (string zoneID, Action handleFinished, Action handleSkipped, Action handleFailed, Action onContinue)
{
if (string.IsNullOrEmpty(zoneID)) zoneID = null;
_handleFinished = handleFinished;
_handleSkipped = handleSkipped;
_handleFailed = handleFailed;
_onContinue = onContinue;
GameObject.Find ("Text").GetComponent<Text> ().text = GameObject.Find ("Text").GetComponent<Text> ().text+
zoneID+"*****"+Advertisement.IsReady();
Debug.Log (zoneID+"*****"+Advertisement.IsReady(zoneID));
if (Advertisement.IsReady(zoneID))
{
GameObject.Find ("Text").GetComponent<Text> ().text = GameObject.Find ("Text").GetComponent<Text> ().text+
"Showing ad now...";
Debug.Log("Showing ad now...");
ShowOptions options = new ShowOptions();
options.resultCallback = HandleShowResult;
//options.pause = true;
Advertisement.Show(zoneID,options);
}
else
{
GameObject.Find ("Text").GetComponent<Text> ().text = GameObject.Find ("Text").GetComponent<Text> ().text+
string.Format("Unable to show ad. The ad placement zone {0} is not ready.",
object.ReferenceEquals(zoneID,null) ? "default" : zoneID);
Debug.LogWarning(string.Format("Unable to show ad. The ad placement zone {0} is not ready.",
object.ReferenceEquals(zoneID,null) ? "default" : zoneID));
}
}
public void ShowAd ()
{
if (!UnityAdsHelper.isSupported)
return;
if (!UnityAdsHelper.isInitialized)
return;
if (UnityAdsHelper.isShowing)
return;
UnityAdsHelper.ShowAd (null, ShowAdFinish);
}
您好~Unity ADs在Android平台上是走Google的通道的,至此,为什么是FALSE您应该清楚了~如果您还不清楚为什么~那么老师只能说~由于国家政策原因~请您放弃Android平台上的Unity ADs(编辑器模式下可以是因为编辑器不是真机,采用的测试模式哦~)