Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to communicate with WebView in Android?

Is it possible to interact with a webview in android trough my native android code?

I develop can bus driver for android and I like to send my can bus data to a html 5 app in a webview without sending them over internet to a webservice. or is it possible to call funktions via the html 5 app in my native android app?

Do you know a good solution for that scenario?

like image 763
znarf Avatar asked Dec 01 '11 12:12

znarf


People also ask

How do you communicate between WebView and native Android?

2.1 To receive data from webview ,we can create an interface, which will enable webview to connect the native layer and pass data. From native layer, create a class and replicate the following. While configuring web view, we need to set JavaScript interface as above JSBridge class.

What is alternative of WebView in Android?

Alternatives to WebView If you want to send users to a mobile site, build a progressive web app (PWA). If you want to display third-party web content, send an intent to installed web browsers. If you want to avoid leaving your app to open the browser, or if you want to customize the browser's UI, use Custom Tabs.

Is WebView deprecated in Android?

This interface was deprecated in API level 12. This interface is now obsolete.


1 Answers

Check out addJavascriptInterface.

like image 192
Felix Avatar answered Sep 26 '22 18:09

Felix