Android Question Google Map question

grafsoft

Well-Known Member
Licensed User
Longtime User
With this code

Code: Copy
Private Sub MapFragment1_Click (Point As LatLng)
    gmapp.AddMarker(Point.Latitude, Point.Longitude, "Markierung")
End Sub

the user can add markers and when he taps the marker, he can ask for directions (lower right corner, left symbol) or search for any place (lower right corner, right symbol). The user will not know this before he/she tries it out.

I would like to have the right symbol - search places - permanently on the screen.

Is there a method to achieve that?
 

Attachments

  • Screenshot_20221014-110930_2.jpg
    Screenshot_20221014-110930_2.jpg
    249.6 KB · Views: 478
Solution
Other
B4X: Copy
Public Sub ShowPointsInMap(Latitude As Double, Longitude As Double)
    Dim GoogleMapIntent As Intent
    GoogleMapIntent.Initialize(GoogleMapIntent.ACTION_VIEW, $"http://maps.google.com/maps?q=${Latitude},${Longitude}"$)
    GoogleMapIntent.SetComponent("android/com.android.internal.app.ResolverActivity")
    StartActivity(GoogleMapIntent)
End Sub
Sorry, I just found the answer myself. The press on the symbols just calls Google Maps. I cannot delete my question ... sorry.
 
Upvote 0
Ah, this is much better than what I did. My "solution" was just a workaround.

I just put a button with a map-symbol on the map and then

Code: Copy
private Sub Bmap_Click
    Dim p As PhoneIntents
    StartActivity(p.OpenBrowser("http://maps.google.com/?q=" & mypoint.Latitude & "," & mypoint.Longitude))
   ' mypoint is the center of the map displayed or the position of the last marker set
End Sub
 
Last edited:
Upvote 0
Other
B4X: Copy
Public Sub ShowPointsInMap(Latitude As Double, Longitude As Double)
    Dim GoogleMapIntent As Intent
    GoogleMapIntent.Initialize(GoogleMapIntent.ACTION_VIEW, $"http://maps.google.com/maps?q=${Latitude},${Longitude}"$)
    GoogleMapIntent.SetComponent("android/com.android.internal.app.ResolverActivity")
    StartActivity(GoogleMapIntent)
End Sub
 
Upvote 0
Solution
Other
B4X: Copy
Public Sub ShowPointsInMap(Latitude As Double, Longitude As Double)
    Dim GoogleMapIntent As Intent
    GoogleMapIntent.Initialize(GoogleMapIntent.ACTION_VIEW, $"http://maps.google.com/maps?q=${Latitude},${Longitude}"$)
    GoogleMapIntent.SetComponent("android/com.android.internal.app.ResolverActivity")
    StartActivity(GoogleMapIntent)
End Sub
Thank you! This is EXACTLY what I wanted!
 
Upvote 0
Back
Top