![]() ![]() now, save changes to the base and cache database path Configuration. INFO, "OSM GPKG cacheDir created: " + Configuration. setOsmdroidTileCache( new File( mapPathTree + "/tiles")) setOsmdroidTileCache( tileCaches) Ĭonfiguration. INFO, "OSM GPKG cacheDir found: " + tileCaches. context(), osmdroidDefaultFolder) įile tileCaches = tileCachefiles. Set tileCachefiles = findCacheFiles( MainApp. INFO, "OSM GPKG SimpleStorage.hasStorageAccess("+ mapPathTree+ "): " + hasAccess) ĭocumentFile osmdroidDefaultFolder = DocumentFileCompat. context())) īoolean hasAccess = SimpleStorage. INFO, "OSM GPKG baseDir created: " + Configuration. setOsmdroidBasePath( new File( mapPathTree)) getExternalStoragePath(), PublicDirectory. Assume the default Android public Documents folder at "/storage/emulated/0/Documents" //set OSMDroid default folder at "/storage/emulated/0/Documents/APP/maps" Stream mapTree = Arrays. These private folders, on the other hand, are hidden from any file manager. If the java.io.File object is utilized in the internal storage of app-specific "private" folders like /data/user/0//files/, there will be no issues. The cache can only be created using the API29+ on my test Android 7.0 device. ![]() Perhaps we can start using the DocumentFile class to totally replace the java.io.File class, eliminating the need to convert DocumentFile instances to java.io.File in several of the codes below that involve Configuration.getInstance().setOsmdroidBasePath(), Configuration.getInstance().setOsmdroidTileCache(), and GeoPackageProvider().īecause the java.io.File class is not supported by the Storage Access Framework (SAF, in this example, the public Documents folder, /Documents, which requires a document provider), the cache could not be created by OSMDroid v6.1.10, used in OSMBonusPack 6.7.0, or OSMDroid v6.1.11, used in OSMBonusPack 6.8.0. I'm attempting to fix the Android 10+ Storage Model issue on my own using the SimpleStorage third-party package, which makes extensive use of the AndroidX DocumentFile class. Bug / Improvement If it's a bug, version(s) of android this affects:Īndroid 11+ (API Level 30 and above) Version of osmdroid the issue relates to: I think this subject needs investigations and suggestions for solutions. The "good" direction defined by Google for file access is based on SAF framework: forget java.io.File class. But again, when publishing your app on Google Play, you can anticipate that it will never be approved (trust me, I tried.). Workaround: you could request MANAGE_EXTERNAL_STORAGE permission. MapsForge maps: outside the app (using File Explorer), you cannot put MapsForge files in a directory than could be read by the app. #Stackoverflow android uri get file path OfflineOffline tiles: outside the app (using File Explorer), you cannot drop files in this cache directory. Good news: If you let osmdroid define its default cache directory, it will target the app "private" directory => usual file read/write is allowed, online tile sources will work fine. This raises various issues for apps using osmdroid features. In short, an app cannot access any file, except files located in its "private" directory, directory which is not accessible to other apps, including File Explorers.Īnd you cannot publish an app on Google Play anymore, if the app is not targeting Android 11. From Android 11, Google introduced drastical constraints on file access. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |