Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Ads Don't Display on Android

Discussion in 'Unity Ads & User Acquisition' started by FabrizioSpadaro, Sep 27, 2014.

  1. FabrizioSpadaro

    FabrizioSpadaro

    Joined:
    Jul 10, 2012
    Posts:
    287
    Hi i have a problem.. i have this script attached to the main camera to display the videoads (the example script on the docu).

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.Advertisements;
    4. public class ADHelper : MonoBehaviour {
    5.  
    6.     void Awake() {
    7.         if (Advertisement.isSupported) {
    8.             Advertisement.allowPrecache = true;
    9.             Advertisement.Initialize("17507",false);
    10.         } else {
    11.             Debug.Log("Platform not supported");
    12.         }
    13.     }
    14.    
    15.     void OnGUI() {
    16.         if(GUI.Button(new Rect(10, 10, 150, 50), Advertisement.isReady() ? "Show Ad" : "Waiting...")) {
    17.             // Show with default zone, pause engine and print result to debug log
    18.             Advertisement.Show(null, new ShowOptions {
    19.                 pause = true,
    20.                 resultCallback = result => {
    21.                     Debug.Log(result.ToString());
    22.                 }
    23.             });
    24.         }
    25.     }
    26. }
    27.  
    when i try on my pc after few second the button text is "Show Ad" and if i click on the button, it show the example picture,
    but if i try on my android tablet the button text is "Waiting" and don't change state, so i can't see the video...

    I guess the problem is Advertisement.isReady() that on my pc became true after some seconds and on my mobile remain false why??
     
  2. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    In your Initilization() method call, the second parameter is set false, disabling testMode. Would you mind setting it to true for the time being and trying the build again, just to make sure you're getting sample ads in testMode?

    I double checked the settings for your game. It looks good from our end.

    Let me know how it works out.
     
  3. FabrizioSpadaro

    FabrizioSpadaro

    Joined:
    Jul 10, 2012
    Posts:
    287
    Hi :)
    I double build and test my app using the test mode
    so in the code:
    Advertisement.Initialize("17507",true);
    but i have the same problem.. the text still remain "Waiting".

    Don't know what's wrong... becouse yesterday using this plug in another game i did it works fine (i see the videos) but with this game no :/
     
  4. FabrizioSpadaro

    FabrizioSpadaro

    Joined:
    Jul 10, 2012
    Posts:
    287
    Hope there is a solution because i don't want return to admob ç_ç
     
  5. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
  6. FabrizioSpadaro

    FabrizioSpadaro

    Joined:
    Jul 10, 2012
    Posts:
    287
    i solved the problem :) , i had a game object called UnityAds :)
     
    Last edited: Oct 19, 2014
    Xiero likes this.
  7. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    You're the second person I've seen report this issue. Going to be adding this as a bug with the asset package.

    Thanks for reporting it!
     
  8. Xiero

    Xiero

    Joined:
    Sep 4, 2013
    Posts:
    1
    Hi Nikkolai,

    I just wanted to report that I also had a game object named UnityAds and renaming it allowed me to see the video test ad.
     
    unity-nikkolai likes this.
  9. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    Thank you for the report! I tried reproducing it last night but wasn't getting the issue consistently. Trying to narrow down the conditions for it. How the GameObject is named looks to be part of the issue. Trying to figure out what's causing the inconsistency now.

    Thanks!
     
  10. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    209
    Hello. Im currently using UnityAd. Is it possible to show a picture banner to the video And not just a text button?
     
  11. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    If you're referring to the buttons that overlay the video ads, I'd like to see the same thing. Not sure yet if those buttons have to be skinned within within the SDK or if there's some customization feature available to devs to set for themselves. I believe it's the former, though. Would like to see the later, for better fit-and-finish and style integration.

    On my list of things to look into. Thanks for bringing it up.
     
  12. RajneeshG

    RajneeshG

    Joined:
    Jan 3, 2014
    Posts:
    15
    I am using UnityAdsHelper.cs which works in Unity Editor but not on actual device.

    I tried both disable/enable TestMode. GameID and/or TestGameID but the result is same.

    What I am doing wrong?
     
    masadov likes this.
  13. xhidnoda

    xhidnoda

    Joined:
    Nov 6, 2012
    Posts:
    23
    I use Playmaker....can anyone tell me, if this code is right? :confused: Because is don't show ad in my Android Device Google Nexus Galaxy. :(
     

    Attached Files:

  14. adam_mehman

    adam_mehman

    Joined:
    Dec 11, 2014
    Posts:
    104
    Hi,

    UnityAds are being showed in Editor but not on Device (they got stuck in the LogWhenUnityAdsIsInitialized() Coroutine.

    What should I do to fix it?

    Regards
     
  15. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Can you please start separate forum threads for individual topics, instead of overloading this thread? Thanks :)
     
  16. adam_mehman

    adam_mehman

    Joined:
    Dec 11, 2014
    Posts:
    104
    Ok, I will. Thank you.
     
  17. VaibhavJaiswal

    VaibhavJaiswal

    Joined:
    Mar 10, 2020
    Posts:
    2
    Bro can i know what you do in order to get ads
    I am having same problem as yours
    Ads showing in editor but not in android device
     
  18. AjayRtsDev

    AjayRtsDev

    Joined:
    Dec 2, 2020
    Posts:
    7
    Link is Not working.
    i am getting the same issue.
    How to solve it?
    Thank you
     
  19. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Hi @AjayRtsDev,

    What error are you getting in your Android device log? You can see logs from Unity Ads SDK by running the following command from command line:

    Code (CSharp):
    1. adb logcat -v time UnityAds:V UnityAdsTest:V "*:S"
    Thanks,
    Rasmus
     
  20. AjayRtsDev

    AjayRtsDev

    Joined:
    Dec 2, 2020
    Posts:
    7
    Hi Rasmus
    com.unity3d.services.core.misc.Utilities.writeFile() (line:127) :: Wrote file: /data/user/0/com.DefaultCompany.UnityAds/files/UnityAdsStorage-public-data.json
    12-14 19:48:33.852 D/UnityAds(18944): com.unity3d.services.core.device.Storage.sendEvent() (line:86) :: Couldn't send storage event to WebApp
    12-14 19:48:33.856 D/UnityAds(18944): com.unity3d.services.core.misc.Utilities.writeFile() (line:127) :: Wrote file: /data/user/0/com.DefaultCompany.UnityAds/files/UnityAdsStorage-public-data.json
    12-14 19:48:33.856 D/UnityAds(18944): com.unity3d.services.core.device.Storage.sendEvent() (line:86) :: Couldn't send storage event to WebApp
    12-14 19:48:33.871 D/UnityAds(18944): com.unity3d.ads.UnityAds.initialize() (line:495) :: ENTERED METHOD
    12-14 19:48:33.871 D/UnityAds(18944): com.unity3d.services.ads.UnityAdsImplementation.initialize() (line:69) :: ENTERED METHOD
    12-14 19:48:33.871 D/UnityAds(18944): com.unity3d.services.UnityServices.initialize() (line:36) :: ENTERED METHOD
    12-14 19:48:33.871 I/UnityAds(18944): com.unity3d.services.UnityServices.initialize() (line:128) :: Initializing Unity Services 3.5.1 (3510) with game id 123456 in production mode
    12-14 19:48:33.874 I/UnityAds(18944): com.unity3d.services.UnityServices.initialize() (line:146) :: Unity Services environment check OK
    12-14 19:48:33.892 I/UnityAds(18944): com.unity3d.services.core.configuration.InitializeThread$InitializeStateConfig.execute() (line:289) :: Unity Ads init: load configuration from https://config.unityads.unity3d.com/webview/3.5.1/release/config.json
    12-14 19:48:43.912 I/UnityAds(18944): com.unity3d.services.core.configuration.InitializeThread$InitializeStateConfig.execute() (line:289) :: Unity Ads init: load configuration from https://config.unityads.unity3d.com/webview/3.5.1/release/config.json
    12-14 19:49:03.942 I/UnityAds(18944): com.unity3d.services.core.configuration.InitializeThread$InitializeStateConfig.execute() (line:289) :: Unity Ads init: load configuration from https://config.unityads.unity3d.com/webview/3.5.1/release/config.json
    12-14 19:49:43.978 I/UnityAds(18944): com.unity3d.services.core.configuration.InitializeThread$InitializeStateConfig.execute() (line:289) :: Unity Ads init: load configuration from https://config.unityads.unity3d.com/webview/3.5.1/release/config.json

    Unity Ads init: network error, waiting for connection events

    This is the log.
    Thank you
     
    Last edited: Dec 14, 2020
  21. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
  22. AjayRtsDev

    AjayRtsDev

    Joined:
    Dec 2, 2020
    Posts:
    7
    yes it is opened on my mobile browser.
    getting a json file.
    But in one of my device it is saying "This site can't be reached".
    But on my testing device i am getting json.

    Thank you
     
    Last edited: Dec 14, 2020