2016-10-10 75 views
1

我開發了一個應用程序。其中,玩家需要購買或觀看獎勵視頻的級別。觀看獎勵視頻播放器需要按下或點擊一個按鈕。但是當我按下按鈕時,什麼都沒有發生!獎勵視頻廣告不顯示統一Android遊戲

我創建了一個文件「AdManager.cs」,代碼如下:

public class AdManager : MonoBehaviour { 
    // before codes 
    . 
    . 
    . 
    //I have created an instance to admanager 
    public static AdManager Instance {set;get;} 
    . 
    . 
    . 
    . 
    void Awake(){ 
    Instance=this; 
    } 
    . 
. 
. 
. 
    //few more codes 
. 
. 
. 
    public void showRewardBasedVideoAd(){ 
     #if UNITY_ANDROID 
     string adUnitId = "xxxxxxxxxxxxxxxxxxxxxxx"; 
     #elif UNITY_IPHONE 
     string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE"; 
     #else 
     string adUnitId = "unexpected_platform"; 
     #endif 
     rewardBasedVideoAd = RewardBasedVideoAd.Instance; 

     rewardBasedVideoAd.OnAdLoaded += HandleOnrewardBasedVideoAdLoaded; 

     rewardBasedVideoAd.OnAdFailedToLoad +=  HandleOnrewardBasedVideoAdFailedToLoad; 

     rewardBasedVideoAd.OnAdOpening += HandleOnrewardBasedVideoAdOpening; 

     rewardBasedVideoAd.OnAdRewarded += HandleOnrewardBasedVideoAdRewarded; 
     rewardBasedVideoAd.OnAdClosed += HandleOnrewardBasedVideoAdClosed; 

     rewardBasedVideoAd.OnAdLeavingApplication += HandleOnrewardBasedVideoAdLeavingApplication; 

     AdRequest request = new AdRequest.Builder().Build(); 
     rewardBasedVideoAd.LoadAd (request, adUnitId); 

     if (rewardBasedVideoAd.IsLoaded()) { 
     rewardBasedVideoAd.Show(); 
     } else { 
     Debug.Log ("Rewarded Video Ad is not Yet ready!!!!"); 
     } 
     } 

     public void HandleOnrewardBasedVideoAdFailedToLoad(object sender, AdFailedToLoadEventArgs args) 
     { 
     print("Interstitial Failed to load: " + args.Message); 

     } 
     public void HandleOnrewardBasedVideoAdLoaded(object sender, EventArgs args) 
     { 
     print("OnAdLoaded event received."); 

     } 
     public void HandleOnrewardBasedVideoAdOpening(object sender, EventArgs args) 
     { 
     print("OnAdLoaded event received."); 

     } 
     public void HandleOnrewardBasedVideoAdClosed(object sender, EventArgs args) 
     { 
     print("OnAdLoaded event received."); 

     } 
     public void HandleOnrewardBasedVideoAdLeavingApplication(object sender, EventArgs args) 
     { 
     print("OnAdLoaded event received."); 

     } 
     public void HandleOnrewardBasedVideoAdRewarded(object sender, Reward args) 
     { 
     string type = args.Type; 
     double amount = args.Amount; 
     print("User rewarded with: " + amount.ToString() + " " + type); 
     totalPoints += 100; 
     Debug.Log("100granted"); 
     } 
    // rest codes 
    } 

我開發這個程序,團結和Android平臺。 我在admob激勵視頻adunit部分創建了unityad中介。有標記說明懸而未決。我無法弄清楚問題出在哪裏。

在這方面指導我!

回答

0

如果您只使用一個網絡來顯示獎勵視頻,則可以簡單地使用Unity ADS SDK而無需任何調解。 我有同樣的問題,幾個月後我放棄了。我使用Admob橫幅廣告/插頁式廣告和UnityAds獲得獎勵視頻,效果很好。

+0

是的,兄弟。我做了同樣的事情。我也放棄了admob獎勵,並使用admob的interstitial/banner和獎勵來自團結的視頻。 – user3487813

相關問題