I am trying to access the HTML Geolocation API available in Android WebView (using SDK version 24).
The main problem is that the call to navigator.geolocat
Actually, navigator is a child of browser global object, the window. you should first access to window then call the navigator. In some modern browsers, In addition to the window, some child object is presented like a global object, for example: location, navigator and etc.
The WebView has no global object window. So you can add it manually, for this action please read this medium article.
Maybe your code will be like below:
my_web_view.evaluateJavascript("javascript: " + "updateFromAndroid(\"" + edit_text_to_web.text + "\")", null);
And then add JavaScript interface, like the window object, to this evaluator:
my_web_view.addJavascriptInterface(JavaScriptInterface(), JAVASCRIPT_OBJ); //JAVASCRIPT_OBJ: like window, like navigator, like location and etc.