Specifically, in the indicated application, the taxi is implemented apparently through some kind of bicycle of its own, or it is a mapkit file processed (in the device monitor output in the webview markup is missing, and the map lies in the normal View). Through my WebView, in my experience, it also works quite well for itself.
In general, here is the implementation of the map output (view initialization):
mapWebView = (WebView) findViewById(R.id.mapWebView); mapWebView.addJavascriptInterface(mapJSInterface, "MyApp"); WebSettings webSettings = mapWebView.getSettings(); webSettings.setJavaScriptEnabled(true); try { InputStream is = getAssets().open("map.html"); byte[] buffer = new byte[is.available()]; if (is.read(buffer) <= 0) Logger.Warn("Can't read embedded assets map.html file!"); is.close(); String htmlText = new String(buffer); mapWebView.loadDataWithBaseURL("http://ru.yandex.api.yandexmapswebviewexample.ymapapp", htmlText, "text/html", "UTF-8", null ); } catch (IOException e) { Logger.Exception(e); } webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
Here is the actual html file (I’ve picked up custom buttons and handlers):
<!doctype html> <html> <head> <title>Map</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="http://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script> <meta name="viewport" content="width=device-width,height=device-height, user-scalable=no"/> <script type="text/javascript"> ymaps.ready(init_map); var myMap; var _ymapZoomPromise = null; function init_map() { var myPlacemark; MyApp.OnPageLoaded(); myMap = new ymaps.Map('map', { center: [48.47655, 135.064308], zoom: 6, controls: [], behaviors: ["default", "scrollZoom"] }, { suppressMapOpenBlock: true, }); myMap.events.add('click', function (e) { var coords = e.get('coords'); // putBaloon(coords); }); } </script> <style> * { -webkit-user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; -webkit-user-modify: unset; } html, body, #map { width: 100%; height: 100%; margin: 0; padding: 0; } #map { background-color: #ffffff; } </style> </head> <body> <div id="map"></div> </body> </html>
Here is MyApp.OnPageLoaded(); javascript interface to the application. When you call, it hides the download progress bar and displays the hidden WebView. Here in this version I checked on 4.0 / 4.1 / 4.2 / 5/6 versions both on real hardware and on emulators. Quite to itself smoothly works and does not twitch even on weak gland. The only negative is that the view loading takes at least 4 seconds.
There are optimization options - to load not all JS API, but only the necessary modules.