Android Question Error opening GMaps

Luiz Fernando Orlandini

Active Member
Licensed User
Longtime User
Hi All,

I getting some strange behavior using Google Maps.

When I call moveCamera and the maps is renderized the maps open with a "default" location and not the latitude and longitude that was passed when the moveCamera is called.

The location that is renderized, looks like a perspective view of World Map with all continents.

Can anybody help me?

Thanks.
 

Luiz Fernando Orlandini

Active Member
Licensed User
Longtime User
Sure Erel.

The follow code is used to initialize my Map.

B4X:
        Try
            If MFragment.IsGooglePlayServicesAvailable = False Then
                  ToastMessageShow("Mapa indisponível no aparelho", True)
            Else
                  MFragment.Initialize("Map", pnlMap)
            End If   
        Catch
            ToastMessageShow("Seu aparelho não tem suporte ao recurso de mapas, e portando um mapa da região não poderá ser exibido", True)
        End Try


B4X:
Sub Map_Ready
    Log("map ready")
      GMaps = MFragment.GetMap
   
      If GMaps.IsInitialized = False Then
          ToastMessageShow("Error initializing map.", True)
      Else
        Dim cp As CameraPosition
          cp.Initialize(LatitudeNotification, LongitudeNotification, 15)
          GMaps.MoveCamera(cp)
        GMaps.TrafficEnabled = True

        Dim BMap As BitmapDrawable
        BMap = AR.GetApplicationDrawable("pinpassageiro")
       
        If (BMap.IsInitialized) Then
            GMaps.AddMarker3(LatitudeNotification, LongitudeNotification, CustomerNameNotification, BMap.Bitmap)
          Else
            GMaps.AddMarker(LatitudeNotification, LongitudeNotification, CustomerNameNotification)
        End If
       
        BMap = AR.GetApplicationDrawable("pintaxista")
        If (BMap.IsInitialized) Then
            GMaps.AddMarker3(GPSTrack.Latitude, GPSTrack.Longitude, "Driver", BMap.Bitmap)
          Else
            GMaps.AddMarker(GPSTrack.Latitude, GPSTrack.Longitude, "Driver")
        End If
       
        Dim OnInfoWindowClickListener1 As OnInfoWindowClickListener
          OnInfoWindowClickListener1.Initialize("OnInfoWindowClickListener1")
     
          If OnInfoWindowClickListener1.IsInitialized Then
            GMapsExtras.SetOnInfoWindowClickListener(GMaps, OnInfoWindowClickListener1)
          Else
            Log("OnInfoWindowClickListener1 is not initialized - check that the Activity contains a Click callback Sub")
          End If
           
    End If
End Sub
 
Upvote 0
Top