Android Question OSMDroid and SDK 23+

udg

Expert
Licensed User
Longtime User
Hi all,
yesterday I was revising an old project of mine based on the wonderful @warwound 's OSMDroid (rel. 4.1) library.
It has a "dangerous" permission (WRITE_EXTERNAL_STORAGE) because it's able to store map tiles in a cache to work off-line.
Once I added the RuntimePermissions library to my code, modified the Manifest to list the dangerous permission and requested the safe GetSafeDirDefaultExternal("") directory, I found there seems to be no way to tell OSMDroid to use it for its caching.
I searched the forum and one message shows that the use of the cache-dir is hard-coded in the original library and somewhat scattered in it, so there was no easy way to change it.

Does all the above mean OSMDroid will be unusable on newer devices (I still usa a 4.4 smartphone)?
I mean, unusable if I set "targetSdkVersion" to 23+ or eventually need to publish my app on the Store when Google will force the "26 boundary".

This is a check made in Activity_Create:
B4X:
If File.ExternalWritable=False Then
       '   OSMDroid requires the use of external storage to cache tiles
       '   if no external storage is available then the MapView will display no tiles
       Log("WARNING NO EXTERNAL STORAGE AVAILABLE")
       ToastMessageShow("No valid storage for maps on the device!",True)
End If

TIA for your comments.

udg
 
Last edited:

udg

Expert
Licensed User
Longtime User
Do you mean just use rp.CheckAndRequest along with the setting in the Manifest and forget about the dir?
 
Upvote 0
Top