Android Question Open GoogleMap Intent from webview link, is it possible?

hillzx

Member
Licensed User
Longtime User
Hi, i am using webview with webviewextras. i open URL maps.google.com and try to click some point location, then try to navigate, clicked "Use the app" (attachment 1), then it can't open google map navigation intent (attachment 2), any idea how to fix this? Thanks a lot

before.jpg after.jpg
 

hillzx

Member
Licensed User
Longtime User
if i load url google.com/maps/search/hotel using webview it will generate hotel markers automatically in near area, i don't know how to do it via GoogleMaps library, as i know we need to input each marker location manually with gmaps library, please correct me if i'm wrong
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Try this
B4X:
Sub WebWiew_OverrideUrl (Url As String) As Boolean
  
  if Url.StartsWith("https://www.google.com/maps/") then
      Intent1.Initialize(Intent1.ACTION_VIEW, url)
      Intent1.SetComponent("android/com.android.internal.app.ResolverActivity")
      StartActivity(Intent1)
  End iF
End Sub
 
Upvote 0

hillzx

Member
Licensed User
Longtime User
Try this
B4X:
Sub WebWiew_OverrideUrl (Url As String) As Boolean
 
  if Url.StartsWith("https://www.google.com/maps/") then
      Intent1.Initialize(Intent1.ACTION_VIEW, url)
      Intent1.SetComponent("android/com.android.internal.app.ResolverActivity")
      StartActivity(Intent1)
  End iF
End Sub
Thank you Star-Dust, this code works perfectly :)
 
Upvote 0
Top