我正在使用两个按钮做一些简单的应用程序...第一个按钮正在发送获奖(测试)广告请求,然后第二个按钮显示广告。
这是我的代码:
using GoogleMobileAds.Api;
using UnityEngine;
using System;
public class adManager : MonoBehaviour
{
RewardBasedVideoAd rewardedAd;
public void Start()
{
rewardedAd = RewardBasedVideoAd.Instance;
requestVideo();
}
public void requestVideo()
{
Debug.Log("Video Requested!");
string adID = "My ad ID";
AdRequest request = new AdRequest.Builder()
.AddTestDevice(AdRequest.TestDeviceSimulator) // Simulator.
.AddTestDevice("BD6E7C35B6F8FA70") // My test device.
.Build();
rewardedAd.LoadAd(request, adID);
}
public void showBannerAd()
{
if (rewardedAd.IsLoaded())
{
Debug.Log("AdAvailible!");
rewardedAd.OnAdRewarded += HandleOnAdRewarded;
rewardedAd.Show();
}
else
{
Debug.Log("AdNotAvailible!");
}
}
public void HandleOnAdRewarded(object sender, EventArgs args)
{
Debug.Log("You are rewarded!");
}
public event EventHandler<Reward> OnAdRewarded;
}
我的代码或其他什么问题? 我尝试过插页式广告和横幅广告,他们付出了努力。
感谢您的帮助。