Search Unity

Force Ads "Refresh"

Discussion in 'Unity Ads & User Acquisition' started by Miguel-Ferreira, Nov 13, 2015.

  1. Miguel-Ferreira

    Miguel-Ferreira

    Joined:
    May 8, 2015
    Posts:
    90
    Hi,

    If the player doesn't have the internet on , Advertisement.IsReady returns false. This is expected since there is no internet. But if the player goes and turns the internet on and returns to the game, Advertisement.IsReady keeps returning false forever and the only way to get the ads back is to kill the game and open it again.

    Is there any way to force the "refresh" of ads through scripting?

    Otherwise it's a pretty bad user experience and a missed monetization opportunity.
     
  2. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Thanks for feedback. Yes, we are aware of this, and it will be fixed in next major version of the Ads SDK. No promises on release date though, but it's in development.

    -Rasmus
     
  3. Miguel-Ferreira

    Miguel-Ferreira

    Joined:
    May 8, 2015
    Posts:
    90
    Hi,

    Tank you for the quick answer. Is there any way at the moment to do some kind of hack to force the refresh, like calling init again or something?

    The thing is that we have a puzzle game and we ask the player to watch a video ad to get a hint. If we detected that the ad failed to load, we ask the player to verify his internet connection. If he goes and connects the internet, come back, and try again, the same message will be displayed
     
    Last edited: Nov 13, 2015
    leandrovtd likes this.
  4. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    1. Which version of Unity are you using?
    2. When are you targeting release date of your game
    3. Do you have code in your game to check for internet connection?

    As such there is probably no way to refresh the init, but we might be able to find a solution where you wait with initialization of ads until internet connection is available.

    -Rasmus
     
  5. Miguel-Ferreira

    Miguel-Ferreira

    Joined:
    May 8, 2015
    Posts:
    90
    I'm using Unity 5.3.0f1 and in spite of this I've already released the game to iOS and Android, but an update is possible.

    That solution of waiting for internet connection before initing the ads seems pretty cool, but is there any way to disable the automatic init of the ads in Unity 5.2+ ?
     
  6. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Hi Miguel,

    Have PM'ed you with a possible solution. Let me know if it works for you, and then we can potentially publish the code here.

    -Rasmus
     
  7. the2mo

    the2mo

    Joined:
    Jun 25, 2013
    Posts:
    2
    Hello ramsus,
    Could you let me know if the work around succeeded or not, i'm willing to give it a try as well
     
  8. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Disclaimer: The code here is not officially supported, but as we also use this for our internal test automation of Unity Ads, it should be possible some way or another. Just so you know, we might change these internal APIs.

    The code is:

    Add Editor\BuildProcess.cs file with:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using UnityEditor.Callbacks;
    4.  
    5. public class BuildProcess : MonoBehaviour
    6. {
    7.         [PostProcessScene]
    8.         public static void OnPostprocessScene()
    9.         {
    10.                 UnityEditor.Advertisements.AdvertisementSettings.enabled = true;
    11.                 UnityEditor.Advertisements.AdvertisementSettings.initializeOnStartup = false;
    12.         }
    13. }
    Now you can initialize using
    Code (CSharp):
    1. Advertisement.Initialize("GAMEID");
    in your code, after you have verified internet connection is available.
     
    Powerade likes this.
  9. MattiasWargren

    MattiasWargren

    Joined:
    Jun 25, 2012
    Posts:
    10
    This is still a problem in Unity 5.4.0f3 when the user enables connection while in game. IsReady() does not change if you don't leave the app (iOS) to return. You don't need to kill the app. Is there any way of refreshing the status?

    The good way of telling the player that the game needs connection should not require the player to leave the game.

    @rasmus-unity
     
  10. adzabazz

    adzabazz

    Joined:
    Nov 20, 2014
    Posts:
    1
    For anyone still looking for an answer to this (as I was), they have since added init functionality to Advertisements so you can quickly resolve this by re-initialising with this line in your code where you check for an internet connection:

    Advertisement.Initialize(Application.identifier);

    Apologies if this was obvious, it wasn't to me.
     
  11. HeathC

    HeathC

    Joined:
    Oct 17, 2016
    Posts:
    110
    thank you... was just looking for this