Quantcast
Channel: Questions in topic: "ads"
Viewing all articles
Browse latest Browse all 1416

Admob rewarded video working in Unity but not on android device.

$
0
0
**Twenty() ia a button ,in my game when i press it ,on the consoole it desplays :Dummy ShowRewardBasedVideoAd, but when i build the game and I press the button ,nothing happens (on the android device)** using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds; using GoogleMobileAds.Api; using UnityEngine.SceneManagement; public class videoAd : MonoBehaviour { public static int Twen; private RewardBasedVideoAd rewardBasedVideo; // Use this for initialization void Start () { RequestInterstitial(); Twen = 15; rewardBasedVideo = RewardBasedVideoAd.Instance; rewardBasedVideo.OnAdRewarded += HandleOnReward; } // Update is called once per frame void Update () { } public void Twenty() { ShowInterstitial(); } private void ShowInterstitial() { if (rewardBasedVideo.IsLoaded()) { rewardBasedVideo.Show(); } } private void RequestInterstitial() { #if UNITY_EDITOR string adUnitId = "unused"; #elif UNITY_ANDROID string adUnitId = " ca-app-pub-1324966xxxxxxxxxxxxxxxxxxxxx"; #elif UNITY_IPHONE string adUnitId = "ca-app-pub-39402560xxxxxxxxxxxxxxxxxxxx"; #else string adUnitId = "unexpected_platform"; #endif RewardBasedVideoAd rewardBasedVideo = RewardBasedVideoAd.Instance; AdRequest request = new AdRequest.Builder().Build(); rewardBasedVideo.LoadAd(request, adUnitId); } public void HandleOnReward(object sender, Reward args) { PlayerPrefs.SetInt("Points", Gamecontroller.PointsNow + Twen); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } }

Viewing all articles
Browse latest Browse all 1416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>