improve how scanner is enabled

re-enable scanner when app is brought back to the foreground

improve the API exposed by the JavaScript plug-in