I have created an app that supports all Android 5.1.1
, Android 9
and Android 10
rugged tablets. The application is built in Xamarin Android native
(not Xamarin Forms). The application uses Leaflet to show maps in a Webview. A custom maps server feeds map tiles to Leaftlet
.
Now bosses want to replace the custom maps server with Mapbox
. Means, now Mapbox should feed map tiles to Leaflet. I have successfully got it working on Android 9
, and Android 10
(in Xamarin Android, Leaflet, Webview). But maps do not show up on Android 5.1.1
at all. My Mapbox initialization code is as below:
var mapboxTiles = L.tileLayer(
`https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token=<my_token>`,
{
attribution: '© <a href="https://www.mapbox.com/feedback/">Mapbox</a>',
tileSize: 512,
zoomOffset: -1,
});
map.addLayer(mapboxTiles);
This same piece of code works well on Android 9
, and Android 10
. But it does not work at Android 5.1.1. I have debugged WebView using Chrome (chrome://inspect) and in case of Android 5.1.1
the JavaScript file (in which I have written the above code) does not even load at all. I want that MapBox should work on Android 5.1.1 also.
Any help or guidance would be appreciated. Thanks guys.