- Home /
 
Unity Ads is working in editor but not on android device
I got Unity Ads to work in the editor, when the ad is triggered i get "Here should be your ad unit (things seem to be working)"
but when i trigger the ad on my device, the sceen goes black and the app restarts completely(showing the unity logo again)
Here is the part of my script that does the ads:
 using UnityEngine.Advertisements;
 
 public class GameController : MonoBehaviour {
     //For Ads
     private const int counterReset = 2;
     public static int counterForAds = counterReset;
 
     void Awake()
     {
         if(Advertisement.isSupported){
             Advertisement.allowPrecache = true;
             Advertisement.Initialize("32885", false);
         }
     }
     public static void resetCounter(){
         counterForAds = counterReset;
     }
     public void GameOver()
     {    
         StopAllCoroutines();
         gameOverText.text = "Game Over!";
         gameOverText.enabled = true;
         if(score > PlayerPrefs.GetInt("Score"))
         {
             PlayerPrefs.SetInt("Score", score);
         }
         counterForAds--;
         if(counterForAds <= 0){
             resetCounter();
             Advertisement.Show (null, new ShowOptions {
                 pause = true,
                 resultCallback = ShowResult => {
                     StartCoroutine(Restart ());    
                 }
             });
         } else {
         StartCoroutine(Restart ());
             //This Coroutine restarts the scene
         }
     }
 
 }
 
               i'm guessing you guys might need additional information, if so please tell me and/or guide me how to find that info because i'm new to this :)
Thank you in advance
Answer by Danor · Apr 22, 2015 at 12:45 AM
It didn't work because i had the option "don't keep activities" on, on my android phone, turning it off solved the issue
$$anonymous$$e siento timado por mi mismo, jajaja mas de un dia buscando, muchas gracias
Your answer
 
             Follow this Question
Related Questions
Chartboost adds are not showing up on android 0 Answers
Google Advertising ID in Unity3D 2 Answers
[HELP] C# GUI, not showing up in camera 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers