Example #1
0
 // Token: 0x06000150 RID: 336 RVA: 0x00004D2C File Offset: 0x00002F2C
 public void Init(string gameId, bool testModeEnabled)
 {
     if (UnityAds.initCalled)
     {
         return;
     }
     UnityAds.initCalled = true;
     try
     {
         if (Application.internetReachability == NetworkReachability.NotReachable)
         {
             Utils.LogError("Internet not reachable, can't initialize ads");
             return;
         }
         IPHostEntry hostEntry = Dns.GetHostEntry("impact.applifier.com");
         if (hostEntry.AddressList.Length == 1 && hostEntry.AddressList[0].Equals(new IPAddress(new byte[]
         {
             127,
             0,
             0,
             1
         })))
         {
             Utils.LogError("Video ad server resolves to localhost (due to ad blocker?), can't initialize ads");
             return;
         }
     }
     catch (Exception ex)
     {
         Utils.LogDebug("Exception during connectivity check: " + ex.Message);
     }
     UnityAdsExternal.init(gameId, testModeEnabled, UnityAds.SharedInstance.gameObject.name, UnityAds._versionString);
 }
Example #2
0
        public void Init(string gameId, bool testModeEnabled)
        {
            // Prevent double inits in all situations
            if (initCalled)
            {
                return;
            }
            initCalled = true;

            try {
                if (Application.internetReachability == NetworkReachability.NotReachable)
                {
                    Utils.LogError("Internet not reachable, can't initialize ads");
                    return;
                }
#if UNITY_ANDROID
                System.Net.IPHostEntry videoAdServer = System.Net.Dns.GetHostEntry("impact.applifier.com");
                if (videoAdServer.AddressList.Length == 1)
                {
                    // 0x7F000001 equals to 127.0.0.1
                    if (videoAdServer.AddressList[0].Equals(new System.Net.IPAddress(new byte[] { 0x7F, 0x00, 0x00, 0x01 })))
                    {
                        Utils.LogError("Video ad server resolves to localhost (due to ad blocker?), can't initialize ads");
                        return;
                    }
                }
#endif
            } catch (System.Exception e) {
                Utils.LogDebug("Exception during connectivity check: " + e.Message);
                return;
            }

            UnityAdsExternal.init(gameId, testModeEnabled, SharedInstance.gameObject.name);
        }
   public void Init(string gameId, bool testModeEnabled, bool debugModeEnabled)
   {
 #if (UNITY_IPHONE || UNITY_ANDROID || UNITY_EDITOR)
       UnityAdsExternal.init(gameId, testModeEnabled, debugModeEnabled && Debug.isDebugBuild, SharedInstance.gameObject.name);
 #endif
   }