// 보상형 광고 private void RequestRewardedAd() { string adUnitId = isTest ? AD.TEST_REWARD : AD.REWARDAD; this.RewardAd = new RewardedAd(adUnitId); // Called when an ad request has successfully loaded. this.RewardAd.OnAdLoaded += HandleRewardedAdLoaded; // Called when an ad request failed to load. this.RewardAd.OnAdFailedToLoad += HandleRewardedAdFailedToLoad; // Called when an ad is shown. this.RewardAd.OnAdOpening += HandleRewardedAdOpening; // Called when an ad request failed to show. this.RewardAd.OnAdFailedToShow += HandleRewardedAdFailedToShow; // Called when the user should be rewarded for interacting with the ad. this.RewardAd.OnUserEarnedReward += HandleUserEarnedReward; // Called when the ad is closed. this.RewardAd.OnAdClosed += HandleRewardedAdClosed; // Create an empty ad request. AdRequest request = new AdRequest.Builder().Build(); // Load the rewarded ad with the request. this.RewardAd.LoadAd(request); AdRequest request2 = new AdRequest.Builder().Build(); RewardedInterstitialAd.LoadAd(adUnitId, request2, adLoadCallback); }
public void InitAdmobRewardedInterstitialAd() { // Create an empty ad request. AdRequest request = new AdRequest.Builder().Build(); // Load the rewarded ad with the request. RewardedInterstitialAd.LoadAd(AdmobRewardInterstitialID, request, AdLoadCallback); }
private IEnumerator CoAwaitForAdDisplay() { AdRequest request = new AdRequest.Builder().Build(); RewardedInterstitialAd.LoadAd(componentTypeStringAdmob, request, AdLoadCallback); //while (rewardedInterstitial.) //yield return null; yield return(new WaitForSeconds(2)); ShowRewardedInterstitialAd(); }
public void RequestAndLoadRewardedInterstitialAd() { statusText.text = "Requesting Rewarded Interstitial Ad."; // These ad units are configured to always serve test ads. #if UNITY_EDITOR string adUnitId = "unused"; #elif UNITY_ANDROID string adUnitId = "ca-app-pub-3940256099942544/5354046379"; #elif UNITY_IPHONE string adUnitId = "ca-app-pub-3940256099942544/6978759866"; #else string adUnitId = "unexpected_platform"; #endif // Create an interstitial. RewardedInterstitialAd.LoadAd(adUnitId, CreateAdRequest(), (rewardedInterstitialAd, error) => { if (error != null) { MobileAdsEventExecutor.ExecuteInUpdate(() => { statusText.text = "RewardedInterstitialAd load failed, error: " + error; }); return; } this.rewardedInterstitialAd = rewardedInterstitialAd; MobileAdsEventExecutor.ExecuteInUpdate(() => { statusText.text = "RewardedInterstitialAd loaded"; }); // Register for ad events. this.rewardedInterstitialAd.OnAdDidPresentFullScreenContent += (sender, args) => { MobileAdsEventExecutor.ExecuteInUpdate(() => { statusText.text = "Rewarded Interstitial presented."; }); }; this.rewardedInterstitialAd.OnAdDidDismissFullScreenContent += (sender, args) => { MobileAdsEventExecutor.ExecuteInUpdate(() => { statusText.text = "Rewarded Interstitial dismissed."; }); this.rewardedInterstitialAd = null; }; this.rewardedInterstitialAd.OnAdFailedToPresentFullScreenContent += (sender, args) => { MobileAdsEventExecutor.ExecuteInUpdate(() => { statusText.text = "Rewarded Interstitial failed to present."; }); this.rewardedInterstitialAd = null; }; }); }
// Use this for initialization 앱 ID void Start() { if (PlayerPrefs.GetInt("outtimecut", 0) == 4 && PlayerPrefs.GetInt("scene", 0) == 0) { cutTime_btn.interactable = false; } color = new Color(1f, 1f, 1f); #if UNITY_ANDROID string appId = "ca-app-pub-9179569099191885~8249233951"; //테스트용ca-app-pub-3940256099942544~3347511713 #elif UNITY_IPHONE string appId = "ca-app-pub-3940256099942544~1458002511"; #else string appId = "unexpected_platform"; #endif // Initialize the Google Mobile Ads SDK. MobileAds.Initialize(appId); //this.RequestBanner(); this.rewardBasedVideo = RewardBasedVideoAd.Instance; // Called when the user should be rewarded for watching a video. rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded; // Called when the ad is closed. rewardBasedVideo.OnAdClosed += HandleRewardBasedVideoClosed; this.RequestRewardedVideo(); this.RequestInterstitial(); // Create an empty ad request. AdRequest request = new AdRequest.Builder().Build(); // Load the rewarded ad with the request. RewardedInterstitialAd.LoadAd("ca-app-pub-9179569099191885/6551741269", request, adLoadCallback); }