title: How to fire javascript event in Android WebView on app resume
body: <p>I have a WebView in my Android app, and I need to run a JavaScript function whenever</p>
  
  <ol>
  <li>the app/WebView is switched to (e.g. using the app switcher or tapping the icon from the home screen)</li>
  <li>the device wakes from sleep (with the app having still been on the screen when the device went to sleep).</li>
  </ol>
  
  <p>Using a <a href="https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API" rel="noreferrer"><code>visibilitychange</code></a> event listener in my webpage javascript only works for case 1.</p>
  
  <p>Ideally I would like to trigger some kind of javascript event using the Android <code>onResume()</code> java function, but how?</p>