Android Question OSMdroid and Adroid 13

AlpVir

Well-Known Member
Licensed User
Longtime User
I would like to use OSMdroid (and MapView) with SDK=32 and Android 13.
The simple project "01 - SimpleMap" ( https://www.b4x.com/android/forum/threads/osmdroid-mapview-for-b4a-tutorial.16310/#content ) displays the map perfectly but when I write in the manifest android:targetSdkVersion="32" instead of the map it opens a desolately empty rectangle.
Also integrating the project with some instructions relating to the possibility of writing to External Storage :
B4X:
Sub Activity_Resume
    Wait For (CheckPermissions) Complete (Success As Boolean)
    If Success = False Then
        Msgbox2Async("You need to grant some permissions in order to install the app", "INSTALLATION ABORTED", "OK", "", "", Null, False)
        Wait For Msgbox_Result (Result As Int)
        ExitApplication
    End If
End Sub

Sub CheckPermissions As ResumableSub
    For Each per In Array(rp.PERMISSION_ACCESS_COARSE_LOCATION ,rp.PERMISSION_ACCESS_FINE_LOCATION, rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
        rp.CheckAndRequest(per)
        Wait For Activity_PermissionResult (permission As String, Result As Boolean)
        If Result = False Then Return False
    Next
    Return True
End Sub

But I read in the Osmdroid documentation :
OSMDroid requires the use of external storage to cache tiles
if no external storage is available then the MapView will display no tiles

If the OSMDroid_3_0_8 library were considered obsolete what alternatives would there be to view OFFLINE maps ?
 

AlpVir

Well-Known Member
Licensed User
Longtime User
Unfortunately the storage path is hard coded into the library which would need to be reworked to use the apps private folder
So, if I understand correctly, there is nothing to do. The otherwise excellent OSMdroid library cannot be used with Android 13.
What alternatives are there to have offline maps that have the ability to draw GPS tracks ?
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
You could look at this
 
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
The suggestion to use B4Xlib is great, however, including this library in a big old project I found some disadvantages:
- it reports that the httpjob module is duplicated
- the same for the HttpUtils2Service module Evidently B4Xlib contains references to OkHttp.
Removing the old httpjob and HttpUtils2Service modules gives an error when calling the CustomListView1.Add.....
I then eliminated the CustomListView module and adopted the XCustomListView library.
The changes, just to have a map, are quite important.
But if it has to be done, it will be done.
 
Upvote 0
Top