Admob rewarded ads is not rewarding after being build
When I watching rewarded on Unity, there is no problem but after building when I watching rewarded, I don't get any rewards. I tried so hard and I can't find. Can you help me guys? Thank you in advance.
public class AdReward : MonoBehaviour {
private RewardedAd rewardedAd;
int rewardAmount;
int coinn;
private void Start()
{
coinn= PlayerPrefs.GetInt("NumberOfCoins");
string adUnitId;
#if UNITY_ANDROID
adUnitId = "ca-app-pub-3940256099942544/5224354917";
#elif UNITY_IPHONE
adUnitId = "ca-app-pub-3940256099942544/1712485313";
#else
adUnitId = "unexpected_platform";
#endif
MobileAds.Initialize(initStatus => { });
this.rewardedAd = new RewardedAd(adUnitId);
rewardedAd.OnUserEarnedReward += HandleUserEarnedReward;
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the rewarded ad with the request.
this.rewardedAd.LoadAd(request);
}
public void HandleUserEarnedReward(object sender, Reward args)
{
double amount = args.Amount;
coinn += (int)amount*20;
PlayerPrefs.SetInt("NumberOfCoins", coinn);
}
public void UserChoseToWatchAd()
{
if (this.rewardedAd.IsLoaded())
{
this.rewardedAd.Show();
}
} }
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613054229im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Ads do not work. help me! 1 Answer
How do I detect if an Admob Banner Ad has been tapped/opened? 1 Answer
Admob Errors 1 Answer
FirebaseAds - DeadObjectException 0 Answers