How to open Maps app from link within app?

How to open Maps app from link within app?

  

Hi,

In our mobile app we want to open native navigation app (Maps in iOS and Google Maos on Android) within a link. On iOS we've managed to do so with "

SyntaxEditor Code Snippet

maps://?q=...

link but on Android none is working :( 

We've tried 

navigator.app.loadUrl("geo:0,0?q....", { openExternal: true });

and 

window.open("google.navigation:q=23.3728831,85.3372199&mode=d" , '_system');

but none of it worked. Using http links  (https://developers.google.com/maps/documentation/urls/guide) opens google maps within the app and only way to return to the app is clicking back arrow...

What is th best practice to open native apps in Android from app?

Thank you

Try to create a link with an href like this

 https://www.google.pt/maps/dir//latitude,longitude/@latitude,longitude,733m/data=!3m1!1e3!4m4!4m3!1m0!1m1!4e1?hl=en

 

Don't forget to replace the latitude and longitude variables

Solution

Hello Mykola,

I have used in a link with the following URL (RedirectToURL): 

"geo:37.786971,-122.399677;u=35"

And also an action that executes a simple JavaScript:

window.location = 'geo:40.765819,-73.975866'

Both opened the Maps App in my android.
But of course, in both cases, to return to my app, I had to use the back, or to open the manager and chose my app.

If you want's to open in the InAppBrowser, you can use the following format in Open's URL

https://www.google.com/maps/dir/?api=1

In this case, the "X" in the top will close the map.

If this is not what you want, please, let us know.

Cheers,
Eduardo Jauch

EDIT:

The method window.location also accepts your URL: 

google.navigation:q=23.3728831,85.3372199&mode=d


Solution

Hi Mykola,

I was also looking for the solution for the problem you are facing, And I found exactly what Eduardo have posted above. Eduardo is right to the point, Implement the solution what he has suggested. It may solve your problem.

https://developers.google.com/maps/documentation/urls/guide

https://stackoverflow.com/questions/10204612/open-google-maps-from-hyperlink

Sachin



Hi Eduardo, 

Thank for reply - it worked.