Hi, I am using the same script on both IOS and Android. Unity Ad works fine on IOS, but it doesn’t show up on Android. I knew that Advertisement.isSupported, Advertisement.isInitialized and Advertisement.isReady are true. Have I missed something? Here is part of my script:
public class UnityAdControl : MonoBehaviour
{
public string gameID;
public bool isShowVideo;
public bool isCheat;
public bool disableTestMode;
void Awake ()
{
if (Advertisement.isSupported)
{
Advertisement.allowPrecache = true;
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
gameID = "????"; // IOS Ad ID
}
else if (Application.platform == RuntimePlatform.Android)
{
gameID = "????"; // Android Ad ID
}
bool enableTestMode = Debug.isDebugBuild && !disableTestMode;
Debug.Log(string.Format("Initializing Unity Ads for game ID {0} with test mode {1}...",
gameID, enableTestMode ? "enabled" : "disabled"));
Advertisement.Initialize(gameID, enableTestMode);
}
}
void Update ()
{
if (isShowVideo)
{
string zoneID = "rewardedVideoZone";
if (string.IsNullOrEmpty(zoneID))
{
zoneID = null;
}
ShowOptions options = new ShowOptions();
options.pause = true;
options.resultCallback = HandleShowResult;
if (Advertisement.isReady(zoneID))
{
Advertisement.Show(zoneID, options);
isShowVideo = false;
}
else
{
isShowVideo = false;
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
IOSNativePopUpManager.showMessage("Video Ad", "Sorry,\nthe Ad is not ready yet!"); // IOS Native Plugin
}
else if (Application.platform == RuntimePlatform.Android)
{
AN_PoupsProxy.showMessage("Video Ad", "Sorry,\nthe Ad is not ready yet!"); // Android Native Plugin
}
}
}
}
public void HandleShowResult (ShowResult result)
{
switch (result)
{
case ShowResult.Finished:
isCheat = true;
break;
case ShowResult.Skipped:
isCheat = false;
break;
case ShowResult.Failed:
isCheat = false;
break;
}
}
}