Unity Ads 3.7.5 missing permission and ads not shown in build?

Hi all and @LIU_Hanyang96 - @kyle-unity - @Unity_Adamski - @JeffDUnity3D

I’m running into a weird issue with ads. My game has been in Google Play since 2016, and ads still function fine. I was updating things for a new release and although everything is the same, when trying ads on an Android device with my latest build, it doesn’t show the ad. Everything works fine in the editor though.

I’m on 2020.3.38f1 with Unity Ads 3.7.5 (I have to stick with that for now because it’ll break other scripts). I’ve tried different ad SDK’s but getting the same result. I’ve required internet access in player settings, and manually added network access state and internet to the manifest. Product ID’s and dashboard setup is accurate. Not in test mode.

I’d love any help with figuring this out. Thank you!

Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.unity3d.player" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <application android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>

Current Ad’s code I’m running in my first scene to initialize ads:

using UnityEngine;
using UnityEngine.Advertisements;

public class NewUnityAds : MonoBehaviour
{
    [SerializeField]
    private string
    androidGameId = "idgoeshere",
    iosGameId = "idgoeshere";

    [SerializeField]
    private bool testMode;

    void Start ()
    {
        string gameId = null;

        #if UNITY_ANDROID
        gameId = androidGameId;
        #elif UNITY_IOS
        gameId = iosGameId;
        #endif

        if (Advertisement.isSupported && !Advertisement.isInitialized) {
            Advertisement.Initialize(gameId, testMode);
        }
    }
}

The log cat is saying:
2022/10/22 12:28:14.212 20386 20420 Debug UnityAds com.unity3d.services.core.misc.Utilities.writeFile() (line:127) :: Wrote file: /data/user/0/com.companyname.appname/files/UnityAdsStorage-public-data.json

2022/10/22 12:28:14.217 20386 20420 Debug UnityAds com.unity3d.ads.UnityAds.initialize() (line:636) :: ENTERED METHOD

2022/10/22 12:28:14.217 20386 20420 Debug UnityAds com.unity3d.services.ads.UnityAdsImplementation.initialize() (line:72) :: ENTERED METHOD

2022/10/22 12:28:14.254 20386 20483 Info UnityAds com.unity3d.services.core.configuration.InitializeThread$InitializeStateConfig.execute() (line:289) :: Unity Ads init: load configuration from config.unityads.unity3d.com/webview/3.7.5/release/config.json

2022/10/22 12:28:15.315 20386 20577 Info UnityAds com.unity3d.services.core.api.Sdk.logInfo() (line:84) :: Requesting configuration from publisher-config.unityads.unity3d.com/games/

2022/10/22 12:28:15.442 20386 20386 Info chromium [INFO:CONSOLE(0)] “Uncaught (in promise) [object Array]”, source: file:///storage/emulated/0/Android/data/com.companyname.appname/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F3.7.4%2F31a458ff4707db1093f4d425a392de90933316c4%2Frelease%2Findex.html&version=31a458ff4707db1093f4d425a392de90933316c4 (0)

2022/10/22 12:28:15.482 20386 20577 Info UnityAds com.unity3d.services.core.api.Sdk.logInfo() (line:84) :: Requesting ad plan from auction.unityads.unity3d.com/v6/games/

2022/10/22 12:28:14.254 20386 20483 Info UnityAds com.unity3d.services.core.configuration.InitializeThread$InitializeStateConfig.execute() (line:289) :: Unity Ads init: load configuration from config.unityads.unity3d.com/webview/3.7.5/release/config.json

2022/10/22 12:28:14.500 20386 20483 Info UnityAds com.unity3d.services.core.configuration.InitializeThread$InitializeStateLoadCache.execute() (line:346) :: Unity Ads init: webapp loaded from local cache

2022/10/22 12:28:15.298 20386 20591 Warn UnityAds com.unity3d.services.core.connectivity.ConnectivityMonitor.connectionStatusChanged() (line:173) :: Unity Ads was not able to get current network type due to missing permission

2022/10/22 12:28:15.458 20386 20577 Warn UnityAds com.unity3d.services.core.device.Device.getNetworkType() (line:135) :: Unity Ads was not able to get current network type due to missing permission


Hi, the above warning is a known issue on certain Android versions. It does not result in any issues displaying ads in your application. This can be suppressed by adding the READ_PHONE_STATE permission.

Hi @Unity_Adamski , I placed that permission in my manifest, and “allowed” it on the device and still no ads in the APP. Ads work fine in the editor still, but when I press to watch an ad, nothing shows. My log cat doesnt show it needs a permission anymore, so thats a good sign, but an ad is not showing. Is there a specific Android version or Unity version/ads SDK that you know for sure works? Any ideas on what to try next? Heres what my log shows now:

2022/10/24 17:16:05.771 32336 32431 Info UnityAds com.unity3d.services.UnityServices.initialize() (line:131) :: Initializing Unity Services 3.7.5 (3750) with game id XXXXXXX in production mode

2022/10/24 17:16:05.776 32336 32431 Info UnityAds com.unity3d.services.UnityServices.initialize() (line:146) :: Unity Services environment check OK

2022/10/24 17:16:07.189 32336 32636 Warn UnityAds com.unity3d.services.core.api.Sdk.logWarning() (line:78) :: {“message”:“model: DeviceInfo key: openAdvertisingTrackingId with value: null: null is not in: string,undefined”,“name”:“CheckValueError”}

2022/10/24 17:06:18.222 28285 28392 Info UnityAds com.unity3d.services.core.configuration.InitializeThread$InitializeStateConfig.execute() (line:289) :: Unity Ads init: load configuration from https://config.unityads.unity3d.com/webview/3.7.5/release/config.json

2022/10/24 17:06:18.567 28285 28392 Info UnityAds com.unity3d.services.core.configuration.InitializeThread$InitializeStateLoadCache.execute() (line:346) :: Unity Ads init: webapp loaded from local cache

2022/10/24 17:06:18.179 28285 28327 Debug UnityAds com.unity3d.ads.UnityAds.initialize() (line:636) :: ENTERED METHOD

2022/10/24 17:06:18.179 28285 28327 Debug UnityAds com.unity3d.services.ads.UnityAdsImplementation.initialize() (line:72) :: ENTERED METHOD

2022/10/24 17:06:18.222 28285 28392 Info UnityAds com.unity3d.services.core.configuration.InitializeThread$InitializeStateConfig.execute() (line:289) :: Unity Ads init: load configuration from https://config.unityads.unity3d.com/webview/3.7.5/release/config.json

2022/10/24 17:06:19.586 28285 28478 Info UnityAds com.unity3d.services.core.api.Sdk.logInfo() (line:84) :: Requesting configuration from publisher-config.unityads.unity3d.com/games/1130496/configuration?deviceMake=samsung&screenDensity=272&screenSize=268435795&idfi=82710530-ee5b-4ccb-93b9-7af9a7190f81&advertisingTrackingId=68ac415b-b4b1-4d0c-af67-0bd28088194f&limitAdTracking=false&installationId=

2022/10/24 17:06:19.753 28285 28285 Info chromium [INFO:CONSOLE(0)] “Uncaught (in promise) [object Array]”, source: file:///storage/emulated/0/Android/data/com.company.game/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F3.7.4%2F2780d594569a532efd8006059e1d8ea6e9d419d4%2Frelease%2Findex.html&version=2780d594569a532efd8006059e1d8ea6e9d419d4 (0)

2022/10/24 17:06:19.792 28285 28478 Info UnityAds com.unity3d.services.core.api.Sdk.logInfo() (line:84) :: Requesting ad plan from https://auction.unityads.unity3d.com/v6/games/gameid/requests?idfi=82710530-ee5b-4ccb-93b9-7af9a7190f81&advertisingTrackingId=68ac415b-b4b1-4d0c-af67-0bd28088194f&limitAdTracking=false&deviceModel=SM-T733&platform=android&sdkVersion=3750&stores=google&deviceMake=samsung&screenSize=268435795&screenDensity=272&apiLevel=32&osVersion=12&screenWidth=2051&screenHeight=1200&connectionType=wifi&networkType=0

@rasmus-unity any thoughts on this? I’ve implemented everything I could find in documentation/google regarding the manifest and still no ads in the build, but everything in the editor works. My game in google play works just fine as it is, but I need to put out an update and the new build isn’t showing ads.

?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.unity3d.player" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  <uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
  <application android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
    <activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityAppLinkActivity" android:exported="true" />
    <activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
    <activity android:name="com.facebook.unity.FBUnityGameRequestActivity" />
    <activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity" />
    <activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity" />
    <activity android:name="com.facebook.unity.AppInviteDialogActivity" />
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="GAMEID" />
    <provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProviderGAMEID" android:exported="true" />
    <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" />
  </application>
  <application>
        <activity
            android:name="com.unity3d.ads.adunit.AdUnitActivity"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
            android:hardwareAccelerated="true"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
        <activity
            android:name="com.unity3d.ads.adunit.AdUnitSoftwareActivity"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
            android:hardwareAccelerated="false"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
    </application>
</manifest>

Hi all, for what it’s worth, my issues were not code related, permissions related, it was Unity Ads SDK related. I don’t know what the issues are on Unity’s end, but I tried numerous SDK’s and the ones that worked for me was 3.6.1, 3.5.0.

@LIU_Hanyang96 - @Kyle_unity - @Unity_Adamski - @JeffDUnity3D

I even removed every permission from access network, internet, read phone state, and activities, and the ads still worked fine in my build when I downgraded to 3.6.1.

Anything 4.0 and above does not work even with all the permissions granted. Will there be an update anytime soon for Android, as the deadline to update the ads SDK to their requirements start in Jan. This isn’t a rare issue as I’ve seen numerous threads so the fix cant be to downgrade to an SDK GooglePlay will no longer accept.

Hi @Ohyouknow , looking at the logs you have shared I can’t see anything wrong. The permissions error would not cause your ads to stop showing. Could you try updating to the latest version of the Unity Ads SDK and be sure that you are using the updated implementation as shown on our docs site.
Also when updating your implementation you will be required to Load an ad every time before you show the ad. I would advise you do this in the OnInitializationComplete and in the OnUnityAdsShowComplete callbacks.

Hi @Unity_Adamski could you please check your PM. I’ve sent you some of my scripts and info for help. Would love to get this figured out with you if possible!

hi @Unity_Adamski - just checking in to see if you had any time to look over the last stuff I sent. Could really use your help