Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Is it safely to assume it's the ISP's fault not initializing Unity Ads here

Discussion in 'Unity Ads & User Acquisition' started by luskos, Jul 25, 2023.

  1. luskos

    luskos

    Joined:
    Mar 4, 2013
    Posts:
    48
    I had to switch from Admob to Unity ads because it was giving me headache trying to figure out why Application crashes at launch. It still crashes with Unity Ads on the same particular model Huawei P30 Pro, but instead the logs are far more meaningful now. Here's what I've got:

    Code (CSharp):
    1. 07-25 13:59:45.456 16019 16052 D UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:129) :: Wrote file: /data/user/0/com.kotlonsoft.fellinhell/files/UnityAdsStorage-public-data.json
    2. 07-25 13:59:45.456 16019 16052 D UnityAds: com.unity3d.services.core.device.Storage.sendEvent() (line:86) :: Couldn't send storage event to WebApp
    3. 07-25 13:59:45.457 16019 16052 D UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:129) :: Wrote file: /data/user/0/com.kotlonsoft.fellinhell/files/UnityAdsStorage-public-data.json
    4. 07-25 13:59:45.457 16019 16052 D UnityAds: com.unity3d.services.core.device.Storage.sendEvent() (line:86) :: Couldn't send storage event to WebApp
    5. 07-25 13:59:45.459 16019 16052 D UnityAds: com.unity3d.services.ads.UnityAdsImplementation.initialize() (line:63) :: ENTERED METHOD
    6. 07-25 13:59:45.459 16019 16052 D UnityAds: com.unity3d.services.UnityServices.initialize() (line:35) :: ENTERED METHOD
    7. 07-25 13:59:45.459 16019 16052 E UnityAds: com.unity3d.services.UnityServices.initialize() (line:89) :: Error while initializing Unity Services: empty game ID, halting Unity Ads init
    8. 07-25 13:59:45.524 16019 16052 I Unity   : Unity Ads Initialization Failed: INVALID_ARGUMENT - Unity Ads SDK failed to initialize due to empty game ID
    9. 07-25 13:59:45.524 16019 16052 I Unity   : AdsInitializer:OnInitializationFailed(UnityAdsInitializationError, String)
    10. 07-25 13:59:45.524 16019 16052 I Unity   : UnityEngine.Advertisements.Utilities.CoroutineExecutor:Update()
    It states it's failing to initialize because there's Empty game ID, but that only happens on P30 Pro, on other device it runs smoothly. Is there anything that can be done. This handset were crashing with Null exception with both Admob and empty game Id in Unity Ads.

    It's almost as if it's by design.

    The code that runs the initialization. Works fine on Redmi Note 8 just fine. This is pretty much copy paste from the documentation.
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Advertisements;
    5. public class AdsInitializer : MonoBehaviour, IUnityAdsInitializationListener
    6. {
    7.     [SerializeField] string _androidGameId;
    8.     [SerializeField] string _iOSGameId;
    9.     [SerializeField] bool _testMode = true;
    10.     private string _gameId;
    11.  
    12.     void Awake()
    13.     {
    14.         InitializeAds();
    15.     }
    16.  
    17.     public void InitializeAds()
    18.     {
    19. #if UNITY_IOS
    20.             _gameId = _iOSGameId;
    21. #elif UNITY_ANDROID
    22.         _gameId = _androidGameId;
    23. #elif UNITY_EDITOR
    24.             _gameId = _androidGameId; //Only for testing the functionality in the Editor
    25. #endif
    26.         if (!Advertisement.isInitialized && Advertisement.isSupported)
    27.         {
    28.             Advertisement.Initialize(_gameId, _testMode, this);
    29.         }
    30.     }
    31.  
    32.  
    33.     public void OnInitializationComplete()
    34.     {
    35.         Debug.Log("Unity Ads initialization complete.");
    36.     }
    37.  
    38.     public void OnInitializationFailed(UnityAdsInitializationError error, string message)
    39.     {
    40.         Debug.Log($"Unity Ads Initialization Failed: {error.ToString()} - {message}");
    41.     }
    42. }
    43.  
    What Unity devs suggested in other topic is that it could be ISP block, because of Couldn't send storage event to WebApp. The device that fails to run the game were tested on Wifi and mobile 4G network.
     
    Last edited: Jul 25, 2023