I'm using osmdroid 5.4.1 lib in android 6.0. I'm asking WRITE_EXTERNAL_STORAGE and ACCESS_COARSE / FINE_LOCATION permissions on realtime. But map not working:
Unable to decode stream: java.io.FileNotFoundException: ... open failed: EACCES (Permission denied)
onRequestPermissionsResult() of the my main Activity calls the following after the user has granted the storage write permission:
public void initTileSources() {
mMapnikTileSource = new XYTileSource(MAPDIR_MAPNIK, 1, MAXZOOMLEVEL, 256, ".png", new String[]{"http://tile.openstreetmap.de/",
"http://tile.openstreetmap.org/"});
mMapView.setTileSource(mMapnikTileSource);
mSeamarksTileSource = new XYTileSource(MAPDIR_SEAMARK, 1, MAXZOOMLEVEL, 256, ".png", new String[]{
"http://t1.openseamap.org/seamark/", "http://tiles.openseamap.org/seamark/"});
TilesOverlay SeamarksOverlay = new TilesOverlay(new MapTileProviderBasic(getActivity(), mSeamarksTileSource), getActivity());
SeamarksOverlay.setLoadingBackgroundColor(Color.TRANSPARENT);
mMapView.getOverlays().add(SeamarksOverlay);
// mMapView.invalidate();
}
The mapview only displays the SeamarksOverlay (openseamap) but not the main mMapnikTileSource (openstreetmap). I have to restart the app in order for the mapview to display everything correctly.
I have seen a similar question on stackoverflow but it hasn't been answered.
Can anyone help me? Thanks in advance.