Android Question [B4XPages] Working with Gmaps, any comprehensive tutorials?

Cableguy

Expert
Licensed User
Longtime User
Hi Guys n Gals

So, I followed the Gmap Tutorial and added the MapFragment, which gets populated withou problems...

1649795362065.png


But I get no other "automatic" interaction with it.
I can manually zoom in and out, but I get no logs and no camera movement by code.

B4X:
    Wait For MapFragment1_Ready
    Log("MapFrag Ready")
    gmap = MapFragment1.GetMap
    rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    Log("Got here")
    If Result Then
        Log("Permission OK")
        gmap.MyLocationEnabled = True
        Dim cp As CameraPosition = gmap.CameraPosition
        Dim NewCP As CameraPosition
        NewCP.Initialize(cp.Target.Latitude, cp.Target.Longitude, cp.Zoom + 1)
        gmap.AnimateCamera(NewCP)
    Else
        Log("No permission!")
    End If
I get the Log("MapFrag Ready") but not the Log("Got here")... So it seems my permission request is pending???


[EDIT] Permission need to be requested on an Activity!!!!
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
Hmmmm, still the permission lib tutorial states its per activity... (Anyway i got it working)
 
Upvote 0
Top