Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Test ads working on editor, but not on Android

Discussion in 'Unity Ads' started by Swordz, Mar 7, 2015.

  1. Swordz

    Swordz

    Joined:
    Jan 24, 2014
    Posts:
    6
    I switched from Admob, but the ads are not playing on the device. They work fine on the editor, but on the device, it just instantly hands out the reward, with no video. I do have Developer mode on, but setting the test mode to off doesn't do anything too.

    I even tried the default call Advertisement.Show(), but it doesn't work.

    I'm normally initializing it with my ID and test mode on. What could be happening?

    I tried checking the manifest, but it looks like unity is the main activity. I only use unibill and the facebook sdk.

    (It doesn't work on iOS too, but for that, I saw that the issue is going to be fixed on the next update)
     
    Last edited: Mar 7, 2015
  2. NatthapolVanasrivilai

    NatthapolVanasrivilai

    Joined:
    Sep 3, 2014
    Posts:
    13
    i cant get it to work too.

    mine Advertisement.isReady() return false on Android, even on testmode.
     
  3. Salazar

    Salazar

    Joined:
    Sep 2, 2013
    Posts:
    236
    Hello ,

    For getting fastest help , you should share some logs from logcat or share your implementation script etc..

    Regards,
     
  4. Swordz

    Swordz

    Joined:
    Jan 24, 2014
    Posts:
    6
    I didn't posted it because there's nothing special on it, but it's basically this:

    On Awake():

    Code (csharp):
    1.   if (Advertisement.isSupported) {
    2.        Advertisement.allowPrecache = true;
    3.        #if UNITY_ANDROID
    4.        Advertisement.Initialize ("19878",true);
    5.        #endif
    6.        #if UNITY_IPHONE
    7.        Advertisement.Initialize ("19877",true);
    8.        #endif
    9.      }
    And then I have this function:

    Code (csharp):
    1.  
    2.   public void Showinst(){
    3.      Advertisement.Show();
    4.    }
    Works on editor, nothing happens on the device. The device is indeed supported
     
  5. Salazar

    Salazar

    Joined:
    Sep 2, 2013
    Posts:
    236
    Hello again,

    1 - You should check if the advertisement is ready. It took some time (3-7sec) to Initialize even if you use test ads, according to your internet connection speed.
    Example;
    Code (CSharp):
    1.  
    2. if(Advertisement.isReady(@"defaultVideoAndPictureZone")
    3. {
    4. Showinst();
    5. }
    6.  
    2 - You should check your default zone in your admin panel or you should define it into your Show() method. There 2 zones in admin panel. ("defaultVideoAndPictureZone" , "rewardedVideoZone") If you use only Show() method, it automaticly uses the default ad zone in your admin panel.
    Example;
    Code (CSharp):
    1. Advertisement.Show(@"defaultVideoAndPictureZone");
    Code (CSharp):
    1. Advertisement.Show(@"rewardedVideoZone");
    3- If non of these helps you, you should post a logcat log as an answer.

    Regards,
     
    Last edited: Mar 8, 2015
  6. Swordz

    Swordz

    Joined:
    Jan 24, 2014
    Posts:
    6
    Forgive my ignorance. It wasn't working because I changed my router but never updated the Wi-Fi connection on the Android device.

    I feel stupid now. It works fine.
     
    Last edited: Mar 8, 2015
  7. Salazar

    Salazar

    Joined:
    Sep 2, 2013
    Posts:
    236
    Hello,

    I think you have trouble with your test device.

    Regards,
     
  8. Swordz

    Swordz

    Joined:
    Jan 24, 2014
    Posts:
    6
    It's working! I think you saw my message before I editted it :p It was an internet problem
     
    Salazar likes this.
  9. dende2019

    dende2019

    Joined:
    Sep 17, 2015
    Posts:
    1
    Hi,

    do I need to connect my device to the internet in order for the using Unity.Advertisement to work?

    It worked before when I had my connection, now I'm working in the bus and the Advertisement. IsReady() is written in red. Error popped out saying the variable Advertisement doesn't exist.

    If that's true then do I need internet connection on my phone to see the ads?
    I'm sorry if it sounds like a dumb question. I'm new to advertising.

    Thanks
     
  10. unity-nikkolai

    unity-nikkolai

    Unity Technologies

    Joined:
    Sep 18, 2014
    Posts:
    541
    Make sure you're using UnityEngine.Advertisements. See the docs here for example.
     
unityunity