Android
Assuming you have already integrated the Scrimmage Rewards Widget into your Android application, you can listen to events emitted by the widget by adding a JavaScript interface to the WebView.
var message by remember { mutableStateOf("") }
// ...
AndroidView(factory = { context ->
WebView(context).apply {
// ...
loadUrl("$url?token=$token")
// Add the JavaScript interface to handle messages
addJavascriptInterface(JavaScriptInterface {
// Handle the received message
message = it
}, "Android")
// ...
}
})
Check out the Widget Events API for more information.
Updated 12 months ago