HMS-Core / hms-ads-demo-java

HUAWEI Ads SDK sample code. HUAWEI Ads SDK provides the banner, native, rewarded, interstitial and splash ad formats for integration.
https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/ads-sdk-introduction?ha_source=hms1
Apache License 2.0
57 stars 20 forks source link

No banner ad is shown with "Ad failed to load with error code 3" message #10

Closed 4ntoine closed 3 years ago

4ntoine commented 3 years ago

Testing on Huawei device with HMS core 5.

Failed to show an ad banner of size SIZE_SMART with "Ad failed to load with error code 3" message: device-2021-01-12-234544

The other sizes can be loaded: device-2021-01-12-234645

In the log i can see:

onAdFailed, errorCode:700

Log file ads_size_smart.txt.zip

4ntoine commented 3 years ago

Also the question: where can one find error codes explanation? eg. SO questions https://stackoverflow.com/questions/65689978/what-huawei-adskit-adlistener-onadfailed-errorcode-2-means and https://stackoverflow.com/questions/65691526/what-are-the-descriptons-for-huawei-adskit-adlistener-onadfailed-error-codes.

There's nothing in the doc.

Mike-mei commented 3 years ago

Can you provide your complete log? You can run this command to return the complete log, adb pull /sdcard/Android/data/com.huawei.hwid/files/Log/HiAdKitLog.log ./.

4ntoine commented 3 years ago

@Mike-mei Thanks for replying.

There's no HiAdKitLog.log there:

Снимок экрана 2021-01-13 в 12 23 42

HMS core version is "5.0.5.300"

Here are the files: hw-logs.zip hw-logs2.zip

Mike-mei commented 3 years ago

@4ntoine The log you provided does not contain the info we need. Could you please provide the Logcat log which contain the error information?

4ntoine commented 3 years ago

@Mike-mei sure, today late evening or early tomorrow

4ntoine commented 3 years ago

@Mike-mei 2021-01-14 22:47:24.739 1377-1544 V:ActivityManage.zip

chenqiuwei commented 3 years ago

Because the dpi of this phone is low, it is 320. and test slotid cannot obtain the ad of the corresponding size. Maybe you could use a high-resolution phone to test it. or set the resolution of your phone following this way: Settings > Display > Screen resolution , and select FHD+, and try again.

4ntoine commented 3 years ago

@chenqiuwei Not sure i understand, i expect SMART_BANNER as banner size to adjust to the devices specs (eg. screen size), no special size (layout_width, layout_height) is set in the app for it as far as i can see. Also 320x100 is shown successfully, and it's a bit surprising why not just fall down to it.

I'm testing on Honor 9S device and i can't find the setting. Probably i will test in cloud debugging.

Are there any requirements/recommendations for ad banners sizes per density, screen size, etc in order to avoid the issues like that?

chenqiuwei commented 3 years ago

https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides-V5/publisher-service-banner-0000001050066915-V5#EN-US_TOPIC_0000001057202899__section2706194414318 Screen Height of Honor 9S is 480dp (720x1440), it should return 720x100dp ad materials, no ad is returned because no test task of this size is launched.

4ntoine commented 3 years ago

@chenqiuwei i'm not sure i want to dive into details on how it works inside.

Can you give advices on when should it be/not_be used? It was expected that it's more efficient than just 1 hard-coded ad size. Should i detect screen density (probably just use default android "per-something" mechanism) and switch to another ad banner size? If yes, what are the other cases that should be covered?

chenqiuwei commented 3 years ago

As described in the development document, the Smart banner determines the ad size based on the screen height of the phone. In this case, the ad size may be different. Sometimes, the ad task may not cover so many sizes. I recommend using a fixed size such as BANNER_SIZE_320_50.

Thanks.