Android Browser intention - opening a navigation application with GPS coordinates

I hope to add a simple solution with one click to the webpage so that Android users can click the "go now" link, which will automatically open a navigation application (such as Google maps) so that they can easily navigate to this destination.

I saw that this is implemented when searching in a browser in an Android browser, for example, when searching for a company name, but I do not seem to know how to do this, and the confusion with the technical terms used in this form of the browser-based API made me come to a dead end.

Can someone enlighten me on what I should look for, you point me somewhere where I can find the answer?

Any help would be greatly appreciated.

+4
source share
5 answers

All you need to do is provide a link to the Google Maps URL (i.e. "http://maps.google.com/maps?saddr=20.344,34.34&daddr=20.5666,45.345"). The browser needs to take care of what is needed because it uses the ACTION_VIEW intent. It will present the user with the option to open in Maps or Browser, depending on whether Maps are installed.

I think these other answers suggest that you are developing an application, but from what I understand, you just want the link on your web page to call Google Maps on Android devices. That being said, all you have to do is what I said above, and it should work fine.

+7
source

I would say that using the Google Map application for your requirement would be better.
If you still want to stick with your browser, you can follow these steps. 1. If you hold the longitude value of longitude in TextView, you can add linify here is the link ,
2. You just need to name the browser URL as follows:
http://maps.google.com/?saddr=34.052222,-118.243611&daddr=37.322778,-122.031944 Replace the values ​​to suit your needs.
This is it.

Good luck

+2
source

Replace

http://maps.google.com/maps?daddr=37.322778,-122.031944 

with:

 google.navigation:q=37.322778,-122.031944 
+2
source

You can use something like this:

 Uri uri = Uri.parse("http://maps.google.com/maps?saddr=" [userLocation] "&daddr=" [destinationLocation] "&z=" + zoomLevel); Intent intent = new Intent(Intent.ACTION_VIEW, uri) startActivity(intent) 

Where you can set the location of the user and the recipient in the format "lat, lng". and zoomLevel is the desired zoom level.

+1
source

after a lot of testing the links, I solved this for me:

<a href="http://maps.google.com/maps?q=loc: <lat>,<lng>&navigate=yes">nav</a>

this opens the user navigator app select menu and it passes the cords you want to switch to.

to use

+1
source

Source: https://habr.com/ru/post/1437601/


All Articles