JavaScript Events

Listen Android UI Events

Add the following <script> in the <head> section of index.html

start() and stop() should defined in index.js

<script>
  function onEvent(eventType) {
    if (eventType == 'OnPlayClick') {
      JavaScriptInterface.runScript(`start();`);
    } else if (eventType == 'OnPauseClick') {
      JavaScriptInterface.runScript('stop();');
    }
  }

  function onLog(message) {
    console.log(message);
  }
</script>

Last updated