Android Question gps map google

fifiddu70

Well-Known Member
Licensed User
Longtime User
I need to locate the position of a vehicle through the GPS from another phone, a phone with the GPS active and a command by text message that sends GPS coordinates, by another phone I get the coordinates via GPS and google maps to know the position of the vehicle.
I managed to get the GPS coordinates but I can not visulizzare the point of the vehicle to control,
from the vehicle I get the following code: Lat Lon 37:39,0332 12:15,5578
of this code can take the result of latitude and longitude and insert them into their texbox, a button will open google maps, but I get the following error: Unable to load the url,
does anyone know why?
here is a piece of my code.

B4X:
Sub btnmap_Click
    Dim Intent1 As Intent
  lat=txtlat.Text
  lon=txtlon.Text
  URI= "geo:" & lat & "," & lon & "?q=" & lat & "," & lon
  Intent1.Initialize(Intent1.ACTION_VIEW,URI)
  Intent1.SetComponent("googlemaps")
  StartActivity(Intent1)
End Sub
 

marcick

Well-Known Member
Licensed User
Longtime User
Hi,
I think 37:39,0332 means 37 degrees and 39,0332 minutes, so you should first
convert those coordinates to the format xx.yyyy where xx are degrees and yyyy are decimal of degrees.

Take minutes/60 and add the result to degrees.
39,0332/60 = 0,65055 so Lat is 37.65055
15,5578/60 = 0,25929 so Lon is 12.25929
(Use dot instead of comma to separate decimals)

Second, probably it will not work the same, because with the latest update of "Maps" it does no longer accept the "geo:" intent ......

You have then two choices:

1) uninstall the latest update of Maps application from the device
2) use internet to open the classic GoogleMap instead of Map, example below:

B4X:
uri="https://maps.google.com/maps?q=" & Lat & "+" & Lon & "&t=h"   
StartActivity(p.OpenBrowser(uri))


hope it helps
Marco
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
What I see is that the map open properly centered on the given coordinates, but the icon is not shown.
I think it still works if you pass an address, but not a couple of coordinates.
Marco
 
Upvote 0

fifiddu70

Well-Known Member
Licensed User
Longtime User
yes the map open properly centered on the given coordinate, but the icon is not show in point of the coordinate
other solution?
 
Upvote 0
Top