Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Ad is not shown after enable internet connection.

Discussion in 'Unity Ads' started by geliosoft, Apr 19, 2016.

  1. geliosoft

    geliosoft

    Joined:
    Jan 7, 2016
    Posts:
    27
    If run the game without internet and then enable connection, no ad will be shown.
    IsReady() always returns false and isInitialized always returns true.
    There is only one way to restore showing ad, restart the game with enabled internet connection.

    Is there any method to reinitialize the ad engine if the internet connection has been restored after starting game?
     
  2. Dragonic89

    Dragonic89

    Joined:
    Jan 3, 2013
    Posts:
    48
  3. unity-nikkolai

    unity-nikkolai

    Unity Technologies

    Joined:
    Sep 18, 2014
    Posts:
    541
    This is a great solution. Thanks, @Dragonic89! We are working to address this in the 2.0 release of Unity Ads, but the release is still several months away. I will also try to incorporate a similar solution into the UnityAdsHelper.
     
  4. meuklight

    meuklight

    Joined:
    Feb 2, 2016
    Posts:
    6
    Hi,
    I am having the same issue but this post is a year old now. Is this still the best solutuon?
     
  5. rasmus-unity

    rasmus-unity

    Unity Technologies

    Joined:
    Aug 15, 2014
    Posts:
    1,181
    Hi @meuklight, we have addressed this issue with the Ads SDK 2.x series. You don't need to manually check for connection before initializing Ads SDK

    /Rasmus
     
  6. geliosoft

    geliosoft

    Joined:
    Jan 7, 2016
    Posts:
    27
    I still check internet connection like this:

    Code (JavaScript):
    1. function UpdateInternetConnection()
    2. {
    3.     var w: WWW = new WWW("http://google.com");
    4.     yield w;
    5.     isConnected = w.error == null;
    6. }
    7.  
    8. function Initialize()
    9. {
    10.     yield UpdateInternetConnection();
    11.  
    12.     if(!Advertisement.isInitialized)
    13.           Advertisement.Initialize(adID, testMode);
    14. }
    15.  
    16. function OnApplicationPause(pauseStatus: boolean)
    17. {
    18.     if(!pauseStatus)
    19.         Initialize();
    20. }
    21.  
     
  7. meuklight

    meuklight

    Joined:
    Feb 2, 2016
    Posts:
    6
    Hi Rasmus,
    I am using Services window -based integrations in Unity 5.6.1f1, can you instruct how to use Ads SDK 2.x.

    It's written in Knowledge base 'Unity 5.5+ includes the latest Unity ads version'
    but I am getting the issue.

    Thanks!
     
    Last edited: Sep 4, 2017
  8. meuklight

    meuklight

    Joined:
    Feb 2, 2016
    Posts:
    6

    Hi,

    I was searching and got this:

    Also using the google web page for an internet reachability check might get you in trouble. Such a use case usually counts as misuse of their services:

    "Don’t misuse our Services. For example, don’t [...] try to access them using a method other than the interface and the instructions that we provide."

    It's from Google and also Google doesn't work in China and Russia so it will be a loss of revenue if we use google.com to check internet. I am still doubtful to use my own domain name instead of google.com.
     
  9. geliosoft

    geliosoft

    Joined:
    Jan 7, 2016
    Posts:
    27
    Google work in Russia, but you can check the country and use desired urls.