我在android 6.0中使用osmdroid 5.4.1 lib。我正在實時詢問WRITE_EXTERNAL_STORAGE和ACCESS_COARSE/FINE_LOCATION權限。 但地圖不工作:osmdroid和棉花糖的動態權限
無法解碼流:java.io.FileNotFoundException:...打開失敗:EACCES(拒絕)
onRequestPermissionsResult(的)我的主要活動調用用戶後,以下授予存儲的寫入權限:
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();
}
的MapView僅顯示SeamarksOverlay(openseamap),但不是主要的mMapnikTileSource(OpenStreetMap的)。我必須重新啓動應用程序才能使mapview正確顯示所有內容。
我已經看到類似的question在計算器上,但它沒有得到回答。
任何人都可以幫助我嗎?提前致謝。