Android-AdvancedWebView icon indicating copy to clipboard operation
Android-AdvancedWebView copied to clipboard

admob

Open sashamerkulev opened this issue 8 years ago • 5 comments

it seems this control breaks requesting/loading admob content.

sashamerkulev avatar Mar 10 '17 14:03 sashamerkulev

This WebView onPause call pauseTimers(), that set all timers at all webviews at pause. I fix it in my code

@Override
    protected void onDestroy() {
        if (webview != null) {
            webview.resumeTimers();
            webview.destroy();
        }
        super.onDestroy();
    }

acousticksan avatar Mar 10 '17 14:03 acousticksan

@AcoustickSan Thanks a lot! Have you been experiencing this problem as well and found that this is a viable solution? So you've verified that the paused timers were indeed the problem for AdMob (or some other JavaScript)?

@sashamerkulev Please try replacing your Gradle dependency with

compile 'com.github.delight-im:Android-AdvancedWebView:75458201f90237e787db84ac091fca79f84beab5'

to see if that changes anything. With that updated dependency, the JavaScript timers should not be paused anymore on API levels 11+ (Android 3.0+). If that was indeed the cause of the problem, as @AcoustickSan suggested, that should help.

ocram avatar Mar 13 '17 23:03 ocram

this code webview.resumeTimers(); helps. thank you.

sashamerkulev avatar Mar 14 '17 05:03 sashamerkulev

@sashamerkulev and @AcoustickSan Any chance that one of you could test the alternative Gradle dependency to check if that solves the problem as well? Would be good to have a solution that works for everybody without additional code. Thanks!

ocram avatar Mar 14 '17 19:03 ocram

Hi! Just came along this thread, and because I had a similar problem myself I just like to add something: pauseTimers will pause all WebViews throughout the app until resumeTimers has been called.

This means that if you pause your webview (e.g. when switching to another fragment/activity in your app) and then show an interstitial (which relies on WebView) the interstitial won't work properly and sometimes can't even be closed.

There appears to be no instance-specific alternative to resumeTimers.

mark-dlc avatar Feb 02 '18 14:02 mark-dlc