Advertisement.isInitialized == true BUT Advertisement.IsReady(myPlacementId) always false ANDROID

I have spent a week now trying to get this working on android. My game serves unity ads perfectly on ios and has done so since day 1 easy peasy… but android? this is has been a hair puller…

as you can see from the title, unity ads inits, but ads are never ready.

Ads actually work on android about 14% of the time.

What would cause this, and what method do I call if IsReady() == false? if ads is initialized, how can I force a rewarded video to get ready? never had to worry about this on ios, it just always works.

Also, if the session starts and won’t serve an ad, no matter what I do to re-initialize it won’t serve that session, so when I say it works 14% of the time, I’m talking sessions.

Are you able to get the device log for a session where the ads aren’t working? There may be an error popping up that is preventing the SDK from working properly.

Here is an error chunk that I captured on a time it wasn’t working…

(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
2020-11-29 23:34:09.072 16195-17058/? E/UnityAds: com.unity3d.services.core.api.Sdk.logError() (line:72) :: Game Configuration Request Failed: {“message”:“FAILED_WITH_ERROR_RESPONSE”,“nativeRequest”:{“method”:0,“url”:“https://publisher-config.unityads.unity3d.com/games/MY ID/configuration?deviceMake=samsung&screenDensity=240&screenSize=268435796&idfi=MY ID&advertisingTrackingId=MY ID&limitAdTracking=false&connectionType=wifi&screenHeight=1848&screenWidth=1200&bundleId=MY GAME BUNDLE ID&encrypted=true&rooted=false&platform=android&sdkVersion=3510&osVersion=10&deviceModel=SM-T515&language=en_US&test=false&analyticsUserId=MY ID&analyticsSessionId=SESSION ID&framework=%5Bobject%20Object%5D&adapter=%5Bobject%20Object%5D”,“headers”:[ ],“retryCount”:1,“options”:{“retries”:2,“retryDelay”:10000,“followRedirects”:false,“retryWithConnectionEvents”:true}},“nativeResponse”:{“url”:“https://publisher-config.unityads.unity3d.com/games/MY ID/configuration?deviceMake=samsung&screenDensity=240&screenSize=268435796&idfi=MY ID&advertisingTrackingId=MY ID&limitAdTracking=false&connectionType=wifi&screenHeight=1848&screenWidth=1200&bundleId=MY BUNDLE ID&encrypted=true&rooted=false&platform=android&sdkVersion=3510&osVersion=10&deviceModel=SM-T515&language=en_US&test=false&analyticsUserId=MY ID&analyticsSessionId=SESSION ID&framework=%5Bobject%20Object%5D&adapter=%5Bobject%20Object%5D”,“response”:“{"error":"context deadline exceeded"}\n”,“responseCode”:500,“headers”:[[“Transfer-Encoding”,“chunked”],[“Alt-Svc”,“clear”],[“Access-Control-Allow-Origin”,“*”],[“X-Android-Received-Millis”,“1606714449052”],[“Date”,“Mon, 30 Nov 2020 17:33:37 GMT”],[“X-Origlength”,“38”],[“Via”,“1.1 google”],[“X-Android-Selected-Protocol”,“http/1.1”],[“X-Service”,“ads-game-configuration”],[“X-Android-Response-Source”,“NETWORK 500”],[“Vary”,“Accept-Encoding”],[“X-Android-Sent-Millis”,“1606714442634”],[“Content-Type”,“application/json”]]}}
2020-11-29 23:34:09.085 16195-16990/? E/UnityAds: com.unity3d.services.core.configuration.InitializeThread$InitializeStateCreate.execute() (line:456) :: Unity Ads SDK fail to initialize due to configuration error
2020-11-29 23:34:09.085 16195-17058/? E/UnityAds: com.unity3d.services.core.api.Sdk.logError() (line:72) :: Initialization error: Unity Ads SDK fail to initialize due to configuration error
2020-11-29 23:34:09.085 16195-16990/? E/UnityAds: com.unity3d.services.core.configuration.InitializeThread$InitializeStateError.execute() (line:495) :: Unity Ads init: halting init in create webapp: Unity Ads SDK fail to initialize due to configuration error
2020-11-29 23:34:09.088 16195-16990/? E/UnityAds: com.unity3d.services.core.configuration.InitializationNotificationCenter.triggerOnSdkInitializationFailed() (line:62) :: SDK Failed to Initialize due to Unity Ads SDK fail to initialize due to configuration error

When I follow that long link that it put in the error, the resulting page reads this…

{“enabled”:true,“assetCaching”:“forced”,“projectId”:“MY PROJECT ID”,“placements”:[{“id”:“video”,“name”:“Video”,“default”:true,“allowSkip”:true,“disableBackButton”:true,“muteVideo”:false,“useDeviceOrientationForVideo”:false,“adTypes”:[“MRAID”,“VIDEO”],“skipInSeconds”:5,“skipEndCardOnClose”:false,“disableVideoControlsFade”:false,“auctionType”:“cpm”,“useCloseIconInsteadOfSkipIcon”:false,“banner”:{“refreshRate”:30}},{“id”:“rewardedVideo”,“name”:“Rewarded Video”,“default”:false,“allowSkip”:false,“disableBackButton”:true,“muteVideo”:false,“useDeviceOrientationForVideo”:false,“adTypes”:[“MRAID”,“VIDEO”],“skipEndCardOnClose”:false,“disableVideoControlsFade”:false,“auctionType”:“cpm”,“useCloseIconInsteadOfSkipIcon”:false,“banner”:{“refreshRate”:30}},{“id”:“Banner”,“name”:“Banner”,“default”:false,“allowSkip”:true,“disableBackButton”:true,“muteVideo”:false,“useDeviceOrientationForVideo”:false,“adTypes”:[“BANNER”],“skipInSeconds”:5,“skipEndCardOnClose”:false,“disableVideoControlsFade”:false,“auctionType”:“cpm”,“useCloseIconInsteadOfSkipIcon”:false,“banner”:{“refreshRate”:30}}],“organizationId”:“MY ORG ID”,“developerId”:MY DEV ID,“properties”:“h2ELnJAswfFCosnN6ewWM0frVD2qcLPBu9yuQLXcH9b6Thf+GE78MvtS9ZuhHtE=”,“loadV5Enabled”:false,“analytics”:false,“test”:true,“abGroup”:2,“token”:“eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWMiOjE3MywiYXpwIjoiMDM3MmU2ZTEtOTliOS00NTcxLTk3NmYtOGViNWU1NTY0ODY1IiwiY3BpIjoyNTIsImNyZWF0ZWQiOjE2MDI2OTQ1NTkwMDAsImR0IjowLCJleHAiOjE2MDc5NjcyNDMsImlhcCI6MSwiaWF0IjoxNjA2NzU3NjQzLCJpc3MiOiJhZHMtZ2FtZS1jb25maWd1cmF0aW9uLnVuaXR5YWRzLnVuaXR5M2QuY29tIiwibHR2IjoxNzUsInBybyI6MzIsInN1YiI6IlBTY29NNVkzZjFuTkF2NGpiQW81L0k3eSs0Y2E5S0ZoYkNsWHVZZ3l1THh1Wkh5WnEzS0ttNVVLWjdENVpJNnJQYVV3amc9PSIsInhwciI6MjM1fQ.ydcRxo5HQjDSej28bvSoGndLWHXKJWTLTqci4Iw3zAA”,“country”:“US”,“subdivision”:“TX”,“gameSessionId”:“SESSION ID”,“disableAdUnitExperiments”:false,“ageGateLimit”:0,“coppaCompliant”:false,“gamePrivacy”:{“method”:“default”},“gdprEnabled”:false,“legalFramework”:“none”,“optOutEnabled”:false,“optOutRecorded”:false,“srcPayoutType”:“cpi”}

@kyle-unity what do you think is the issue?

here’s another error I got from another time of not working…

2020-12-01 01:21:09.036 7685-9214/? E/UnityAds: com.unity3d.services.core.api.Sdk.logError() (line:72) :: {“message”:“Caching failed”,“name”:“CacheStatusFailed”}
2020-12-01 01:21:09.214 7685-9214/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:84) :: Webview started using the latest version
2020-12-01 01:21:10.003 7685-7685/? D/ViewRootImpl@763d04[UnityPlayerActivity]: ViewPostIme pointer 0
2020-12-01 01:21:10.044 7685-7685/? D/ViewRootImpl@763d04[UnityPlayerActivity]: ViewPostIme pointer 1
2020-12-01 01:22:41.956 7685-9214/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:84) :: Requesting ad plan from https://auction.unityads.unity3d.com/v4/test/games/MY ID/requests?idfi=MY ID&advertisingTrackingId=MY ID&limitAdTracking=false&deviceModel=SM-T515&platform=android&sdkVersion=3510&stores=google&deviceMake=samsung&screenSize=268435796&screenDensity=240&apiLevel=29&test=true&screenWidth=1200&screenHeight=1848&connectionType=wifi&networkType=0
2020-12-01 01:22:42.485 7685-9214/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:84) :: AdPlan received with 1 campaigns and refreshDelay 0
2020-12-01 01:22:42.517 7685-9214/? E/UnityAds: com.unity3d.services.core.api.Sdk.logError() (line:72) :: {“message”:“Caching failed”,“name”:“CacheStatusFailed”}
2020-12-01 01:23:02.216 7685-7685/? D/ViewRootImpl@763d04[UnityPlayerActivity]: ViewPostIme pointer 0
2020-12-01 01:23:02.274 7685-7685/? D/ViewRootImpl@763d04[UnityPlayerActivity]: ViewPostIme pointer 1

Looks like there are two errors happening here so far. The first log has a FAILED_WITH_ERROR_RESPONSE for one of the http requests, indicating that there was an issue with your internet connection accessing our servers. I’m not aware of any outages that are ongoing so I’m not sure what the problem could be there.

Are you able to try using a traffic analysis tool (such as Charles Proxy) to get more information? If we can see the details of the calls being made to our servers, it should be clear what the blocker is.

The second log is showing an error with the caching process. It could be an issue with your device’s available memory? Which device are you testing with?

Do you have a build we can test? My suspicion is that your implementation is actually correct, but an issue with your device or possibly connection is preventing the SDK from initializing most of the time. I’d like to test it myself to see if it works here. You can send this to unityads-support@unity3d.com if you don’t want to share publicly.

For the benefit of people finding this thread, the problem turned out to be the device had the wrong time set, which was affecting some of the HTTPS calls made to the Unity servers. SSL certificate handshakes are used to ensure the security of calls the SDK makes to the servers, and these can fail if there is a time mismatch between the device and server.

Once the correct time was set, the problems seemed to go away :slight_smile: