Starting the GEO URI intent

bluedude

Well-Known Member
Licensed User
Longtime User
Had no luck in running it with the following code:

mapIntent.Initialize(mapIntent.ACTION_VIEW , "geo:")
mapIntent.Putextra("latitude",mapSettings.Get("latitude"))
mapIntent.Putextra("longitude",mapSettings.Get("longitude"))
StartActivity(mapIntent)

Any suggestions?
 

mkvidyashankar

Active Member
Licensed User
Longtime User
intent

Hi

i am just learning B4a
i tried your code


Dim Intent1 As Intent
lat="40.56789"
lon="8.98765"
URI= "geo:" & lat & "," & lon & "?q=" & lat & "," & lon

Intent1.Initialize(Intent1.ACTION_VIEW,URI)
Intent1.SetComponent("googlemaps")
StartActivity(Intent1)


but i am getting error in startactvity(intent1)

"No activity found to handle intent"

Can u please guide
 
Upvote 0

ZJP

Active Member
Licensed User
Longtime User
The complete code. Do not forget to select the Phone library :)

JP

B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
   Dim Intent1 As Intent
   lat="40.56789"
   lon="8.98765"
   URI= "geo:" & lat & "," & lon & "?q=" & lat & "," & lon

   Intent1.Initialize(Intent1.ACTION_VIEW,URI)
   Intent1.SetComponent("googlemaps")
   StartActivity(Intent1)

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 
Last edited:
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
This is from the MapView example, which worked well when I was testing. The Long and Lat need to be updated to your location for the PosLat PosLong and the long and lat (39.12345 -104.12345). I believe the supplied parameters in PosLat etc. are somewhere near Paris France.


Dim PosLat as List
Dim PosLong as list
PosLat.Initialize
PosLong.Initialize

PosLat.Add(46.1348)
PosLong.Add(7.1132)
PosLat.Add(46.1364)
PosLong.Add(7.1122)
PosLat.Add(46.1380)
PosLong.Add(7.1152)
PosLat.Add(46.1386)
PosLong.Add(7.1147)
PosLat.Add(46.1395)
PosLong.Add(7.1170)
PosLat.Add(46.1409)
PosLong.Add(7.1189)
Dim MapWebView as Webview
MapWebView.Initialize("")
Activity.AddView(MapWebView,0,50,100%x,88%y)

If loc.Latitude = 0 Then
loc.Latitude = 39.12345
End If
If loc.Longitude = 0 Then
loc.Longitude = -104.12345
End If
ShowMap(39.12345, -104.12345, 15, True, True, True, "TOP_LEFT", True, PosLat, PosLong, True, True, "#ff0000", 0.5, 3)
 
Upvote 0
Top