Android Question Google Map: Keep heading direction top (North) ?

Daica

Active Member
Licensed User
I am trying to make the Google Map camera/rotation face North when the user is moving/driving.
I am using the following code but the camera doesn't move.

B4X:
Sub SetBearing(bearing As Double)
    Dim currentCamera As CameraPosition = B4XPages.MainPage.P_Map.gmap.CameraPosition
    Dim newCamera As CameraPosition
    newCamera.Initialize2(currentCamera.Target.Latitude, currentCamera.Target.Longitude, currentCamera.Zoom, bearing, currentCamera.Tilt)
    B4XPages.MainPage.P_Map.gmap.AnimateCamera(newCamera)
End Sub

B4X:
Public Sub LocationChanged(Location1 As Location)

    If Location1.BearingValid Then LastLocation = Location1
    If Location1.BearingValid Then SetBearing(Location1.Bearing)
End Sub

Basically I'm trying to replicate what Google Map looks like while you're navigating, but I would like to do so without navigation

Also side question but related, is there something I can use to emulate driving so I don't have to go out for a drive to test? lol
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…