Quantcast
Channel: Questions in topic: "admob"
Viewing all articles
Browse latest Browse all 137

Admob rewarded ads is not rewarding after being build

$
0
0
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(); } } }

Viewing all articles
Browse latest Browse all 137

Trending Articles