Hi Joao,
Thank you for reaching out to us.
Could you please provide the following details via Reply privately to author option or send it directly to mobileads...@gmail.com?
Regards,
|
||||||
Hi Joao,
Thank you for reaching out to us.
Could you please provide the following details via Reply privately to author option or send it directly to mobileadstesting99@gmail.com?
|
||||||
Hi Greg,
Thank you for your patience. I've connected with the team on this case, and at this time, I'm afraid that this is still under investigation. I've followed up again with the team to see if there is something they can provide and will let you know when I hear back.
Regards,
|
||||||
|
||||||
For whatever it’s worth, I’d like to share my current hypothesis why these ANRs happen in my app, and maybe in at least for 2 other developers that reported similar issues. Maybe it will inspire someone familiar with WebView internals to find the reason in the recent updates of WebView code.
Hypothesis 1
---------------------
Years ago I noticed that the mobile ads were still running, handling executing maybe Javascript code, when the activity hosting them in my app was paused and hidden. I was calling AdMob’s adView.pause() at that time too, but it did not prevent these ads running and animating(?) in the background, wasting processor cycles and the battery. My app is “read text aloud” app, very often used with the screen turned off, or e.g. while the user is playing some game while listening to my app reading an ebook or a list of saved articles. Therefore I added in my app’s onPause() method a code to find the WebView control in AdMob’s adView, and call:
webView.loadUrl("about:blank");
as the WebView docs say: “Use WebView.loadUrl("about:blank") to reliably reset the view state and release page resources (including any running JavaScript)” Maybe this loading of “about:blank” is no longer necessary these days to pause ads in a background activity?
Since it was called in the activity’s onPause() method, the activity and any ads it was showing are no longer visible. Could this be a problem, after some WebView update in March 2021, that aborting some Javascripts running with this call could cause an ANR? Please note that for many years this call did not cause any problems, they started only in March. I currently made a limited (staged) release of my app where this call is commented out, to see if it will affect the ANR rate.
Hypothesis 2
----------------------
My app uses WebView in its own code too, to display web articles or ebooks, and also creates temporary WebViews when necessary to download some web contents with Javascript running. When these temporary WebViews were no longer needed I destroy them, but this caused huge memory leaks in Android. I found out that it was necessary to manually remove a WebView from the activity View tree before destroying it etc. Lots of problems there. I was using the following code to destroy it:
// Extra
WebView destroy code after https://stackoverflow.com/questions/17418503/destroy-webview-in-android
mWebView.clearHistory();
mWebView.loadUrl("about:blank");
mWebView.onPause();
mWebView.removeAllViews();
mWebView.destroyDrawingCache();
mWebView.pauseTimers();
of course WebView.pauseTimers() pauses all times and Javascript execution in all webViews in the process, therefore also in AdMob ads. I was calling resumeTimers() in any onResume() of course. Could this be now causing the ANRs? In the limited test release I also commented out the pauseTimers() code. This code too was working fine for years, and the ANRs started only in March.
Will see if any of this will affect the horrific ANR rate now reported in my ad. Too early to say right now.
Greg
|
||||||
|
||||||
|
||||||
|
||||||
Hello Roman,
Thank you for reaching out to us.
With regard to your concern, I'm afraid we don't have any control for Google Play. To better assist you on this concern, we recommend raising this to Google Play console team.
Regards,
|
||||||
Hi Roman,
I understand your concern. However, I’m afraid that we’re left with not much of an option here since the ANRs you’ve reported were not cause by Mobile Ads SDK. It would be best to bring this up to Google Play Support team instead, in order to actually make any progress in diagnosing this.
Regards,
|
||||||