Search Unity

Admob rewarded ads problem

Discussion in 'Unity Ads & User Acquisition' started by fatih00008, Feb 24, 2019.

  1. fatih00008

    fatih00008

    Joined:
    Feb 21, 2019
    Posts:
    1
    When I try to use rewarded ads, the application crashes after the ad is finished.
    Code (CSharp):
    1.     private void LoadRewardBasedAd(){
    2.         #if UNITY_EDITOR
    3.             string adUnitId = "unused";
    4.         #elif UNITY_ANDROID
    5.             string adUnitId = "ca-app-pub-4368344866239036/5911893731";
    6.         #else
    7.             string adUnitId = "unexpected_platform";
    8.         #endif
    9.         rewardBasedVideoAd.LoadAd(new AdRequest.Builder().Build(), adUnitId);
    10.     }
    11.     public void HandleOnAdLoaded(object sender,EventArgs args){
    12.         //ready_text.text = "Ad Has Been Loaded";
    13.         rewardBasedVideoAd.Show();
    14.     }
    15.     public void HandleOnAdFailedToLoad(object sender,AdFailedToLoadEventArgs args){
    16.         LoadRewardBasedAd();
    17.         //try to load
    18.         //ready_text.text = "failed to load";
    19.     }
    20.     public void HandleOnAdOpening(object sender,EventArgs args){
    21.         //Pause the action
    22.         //ready_text.text = "Ad Has Been Opened";
    23.     }
    24.     public void HandleOnAdStarted(object sender,EventArgs args){
    25.     //mute the audio
    26.     //ready_text.text = "Ad Has Been Started";
    27.     }
    28.     public void HandleOnAdClosed(object sender,EventArgs args){
    29.  
    30.     }
    31.     public void HandleOnAdRewarded(object sender,Reward args){
    32.         rewarded.SetActive(true);
    33.     }
    34.     public void HandleOnAdLeavingApplication(object sender,EventArgs args){
    35.        
    36.     }
     
  2. StartStart

    StartStart

    Joined:
    Jan 2, 2013
    Posts:
    150
    Use lastest
    -Unity
    -ndk
    -all SDK tools in Android Studio
    -Google Adsmob .unitypackage
    -Play Service Resolver

    That should be fine if you use lastest version.

    If it's not working try to clean your project about ADS then re-import.
     
    mikaisomaa likes this.