为什么 AdMob interstitial lock UI 线程?
Why AdMob interstitial lock UI thread?
在使用 Method Tracing 实用程序时,我遇到了 Android AdMob 插页式广告的问题。
现在我使用的是最新版本的 AdMob:
compile 'com.google.firebase:firebase-ads:9.4.0'
还有这段代码:
long start = System.currentTimeMillis();
interstitialAd.loadAd(adRequest);
Log.d(TAG, "load: " + (System.currentTimeMillis() - start) + " ms");
打印:
load: 1250 ms
并锁定 UI 线程。
示例设备:LG G3 Android 5.0.
我不明白为什么它会锁定。
P.S。日志
09-08 11:35:52.294 I/Ads: Starting ad request.
09-08 11:35:52.297 I/Ads: Use AdRequest.Builder.addTestDevice("C847646CE34895E5C61DEA64E092F1A5") to get test ads on this device.
09-08 11:35:53.157 W/Ads: The webview is destroyed. Ignoring action.
09-08 11:35:53.224 E/Ads: JS: Uncaught ReferenceError: AFMA_ReceiveMessage is not defined (:1)
09-08 11:35:53.546 I/Ads: Scheduling ad refresh 30000 milliseconds from now.
09-08 11:35:53.553 I/Ads: Ad finished loading.
P.S.2
我在官方 AdMob Googe Group 中查找问题的答案
Answer
我认为这是一个错误,应该报告给 Firebase 团队。我正在查看 InterstitialAd documentation,它清楚地表示 loadAd
:
Start loading the ad on a background thread.
如果完成这个方法需要这么长时间,我很确定它实际上没有使用后台线程,或者至少没有正确使用。您可以尝试在慢速网络上拨打此电话,在这种情况下,我认为您会收到 ANR。这应该确认这是一个阻塞调用。
在使用 Method Tracing 实用程序时,我遇到了 Android AdMob 插页式广告的问题。
现在我使用的是最新版本的 AdMob:
compile 'com.google.firebase:firebase-ads:9.4.0'
还有这段代码:
long start = System.currentTimeMillis();
interstitialAd.loadAd(adRequest);
Log.d(TAG, "load: " + (System.currentTimeMillis() - start) + " ms");
打印:
load: 1250 ms
并锁定 UI 线程。
示例设备:LG G3 Android 5.0.
我不明白为什么它会锁定。
P.S。日志
09-08 11:35:52.294 I/Ads: Starting ad request.
09-08 11:35:52.297 I/Ads: Use AdRequest.Builder.addTestDevice("C847646CE34895E5C61DEA64E092F1A5") to get test ads on this device.
09-08 11:35:53.157 W/Ads: The webview is destroyed. Ignoring action.
09-08 11:35:53.224 E/Ads: JS: Uncaught ReferenceError: AFMA_ReceiveMessage is not defined (:1)
09-08 11:35:53.546 I/Ads: Scheduling ad refresh 30000 milliseconds from now.
09-08 11:35:53.553 I/Ads: Ad finished loading.
P.S.2
我在官方 AdMob Googe Group 中查找问题的答案 Answer
我认为这是一个错误,应该报告给 Firebase 团队。我正在查看 InterstitialAd documentation,它清楚地表示 loadAd
:
Start loading the ad on a background thread.
如果完成这个方法需要这么长时间,我很确定它实际上没有使用后台线程,或者至少没有正确使用。您可以尝试在慢速网络上拨打此电话,在这种情况下,我认为您会收到 ANR。这应该确认这是一个阻塞调用。