Android Question Google maps intent

AlteregoHR

Member
Licensed User
Longtime User
Hello,

I have find way to send intnet to google maps for navigation between "Current location" and some destination.
Is it possible to send intent that will start navigation between two locations?

Thanks.
 

AlteregoHR

Member
Licensed User
Longtime User
Thank you for replay.
That is what I have, but i need to send Deatination and Location.
I want it to show path from location that I will specify to the destination, not from currnet location.
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Upvote 0

NJDude

Expert
Licensed User
Longtime User
I want it to show path from location that I will specify to the destination, not from currnet location.
In that case, the intent is like this:
B4X:
Dim i As Intent
 
i.Initialize(i.ACTION_VIEW, "http://maps.google.com/maps?saddr=New York City, NY,&daddr=Washington, DC")
i.SetComponent("com.google.android.apps.maps/com.google.android.maps.MapsActivity")
 
StartActivity(I)
 
Upvote 0

AlteregoHR

Member
Licensed User
Longtime User
This is the code that I use now for Intent for google maps from Current location to some other location.
When intent starts it goes to maps and open window to start geting directions and field destination is populated with lat, lon and field Start point says My location. I would like for that field also to be populated with location ( example 40,720, -74,005).

B4X:
Dim lat As Double: Dim lon As Double
    Dim Intent1 As Intent: Dim URI As String
    lat=latitude
    lon= longitude
    
    URI= "geo:" & lat & "," & lon & "?q=" & lat & "," & lon
    
    Intent1.Initialize(Intent1.ACTION_VIEW,URI)
    Intent1.SetComponent("googlemaps")
    StartActivity(Intent1)

Can you help me write URI for your example. The example above doesnt open maps directly but ask me with which program to open.
I hope I am making sense :)
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
The code is the same I posted before, just replace the arguments with Lat and Lon.
B4X:
Dim i As Intent
 
i.Initialize(i.ACTION_VIEW, "http://maps.google.com/maps?saddr=" & fromLat & "," & fromLon  & "&daddr=" & toLat & "," & toLon)
i.SetComponent("com.google.android.apps.maps/com.google.android.maps.MapsActivity")
 
StartActivity(i)
 
Last edited:
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
How can i get the lat & lon when pressing on the map (i.e. as destination or (better) when a pre-setted Marker was clicked ?
Also by an intent ?
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
Found :

B4X:
Sub Map_MarkerClick (SelectedMarker As Marker) As Boolean
  Log(SelectedMarker.Title)
  Return True
End Sub
 
Upvote 0
Top