--
You received this message because you are subscribed to the Google Groups "Mapsforge & VTM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapsforge-dev/5d3f93bc-b302-2702-6a65-733b4bd22c3e%40gmail.com.
But I also think that worrying too much about storage is not really appropriate any more. Unless you are targeting particularly low spec phones I think this is not an issue any more.
There is a misunderstanding: libraries are libraries, they don't need to work with any shared data.
Applications request to work with shared data.
And Android decided that is bad, no secure, etc. so will allow access only to app specific directories.
MapFile can already read File or FileChannel.
Internally there is somewhere input stream, probably can add an extra constructor.
Note that current public API should remain to not break user applications.
I got an Uri via Storage Access Framework, got an InputStream via ContentResolver, casted it to FileInputStream and fed it to the MapFile:
protected MapDataStore getMapFile() {
if (baseApplication.getMap() == null) {
return null;
}
final Uri mapFile = baseApplication.getMap();
if (mapFile == null || !DocumentFile.isDocumentUri(this, mapFile)) {
return null;
}
try {
FileInputStream inputStream = (FileInputStream) getContentResolver().openInputStream(mapFile);
return new MapFile(inputStream, 0, null);
} catch (Exception e) {
Log.e(TAG, "Can't open mapFile", e);
}
return null;
}