Skip to main content
The Notifly Android SDK uses a WebView internally to display in-app popups.On Android, JavaScript in a WebView can continue to run while the app is in the background and consume resources unnecessarily. To control WebView timers, call pauseTimers() and resumeTimers() at the appropriate points in the Activity lifecycle.

1. Control WebView timers

pauseTimers() and resumeTimers() affect all WebViews in the app, rather than only the instance on which you call them. If your app has multiple WebViews, these calls can also affect the other WebViews.

2. Behavior before SDK 1.8.0

Before version 1.8.0, the Notifly Android SDK automatically called pauseTimers() in the in-app popup Activity’s onPause() method and resumeTimers() in its onResume() method.The following example shows the Activity that displays in-app popups in those versions.

3. Potential issues and recovery

In versions before 1.8.0, a call to pauseTimers() just after an in-app popup closes can also pause other WebViews in the app and stop them from working.If this happens, call resumeTimers() on a WebView instance to resume the timers.

4. If an in-app popup does not appear

Check that WebView timers are running when the in-app popup should appear. In particular, check that pauseTimers() has not left the timers paused.