Android Question Migrating to B4xpages Google Maps

Good night, I'm migrating to B4x pages and I can't display the location on Google maps. Can someone help me.


The Application is stopped on the line

**Wait For MapFragment1_Ready***



Google Maps:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    'load the layout to Root
    Root.LoadLayout("Localizacao")

   
    Wait For MapFragment1_Ready
    gmap = MapFragment1.GetMap
    rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
   

    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If Result Then
        Dim CameraPosition1 As CameraPosition
        CameraPosition1.Initialize(B4XPages.MainPage.lat, B4XPages.MainPage.longi,17)
       
        gmap.AnimateCamera(CameraPosition1)
        gmap.MyLocationEnabled = True
        gmap.AddMarker(B4XPages.MainPage.lat, B4XPages.MainPage.longi, B4XPages.MainPage.estab)
       
    Else
        Log("No permission!")
    End If

End Sub
 
Last edited:
I arrived at this solution;)

Solution:
Private Sub B4XPage_Appear
    Wait For MapFragment1_Ready
    gmap = MapFragment1.GetMap
    rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
 [B]   Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)[/B]
    If Result Then
        Dim CameraPosition1 As CameraPosition
        gmap.MyLocationEnabled = True
        CameraPosition1.Initialize(B4XPages.MainPage.lat, B4XPages.MainPage.longi,17)
        gmap.AnimateCamera(CameraPosition1)
        gmap.AddMarker(B4XPages.MainPage.lat, B4XPages.MainPage.longi, B4XPages.MainPage.estab)
    Else
        Log("sem permissão")
    End If
 [/ CODE]
 
Last edited:
Upvote 0
Top