Android: start maps with route - android

I know it is possible to start google maps with a route of 2 points but I really need to start it with many waypoints. How can this be done?
And another big wish would be: (I really doubt that this is possible but who knows?)
Can you somehow put those waypoints information into an intent so that it isn't necessarily for google maps but for ANY navigation app? So that the user can choose his own navigation app...?

Ok I found a way to do it with google maps:
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("https://maps.google.ch/maps?saddr=[address1]&daddr=[address2] to:[address3] to: [address4]"));
startActivity(intent);
(Replace [address#] with the waypoints)
The problem is that the google maps app doesn't show all the waypoints but only the first and the last. I'd really like to make all waypoints visible and to make navigation actually navigate you to the points and telling you when you've reached one, but google doesn't seem to think that this is needed...

Related

Is it possible to draw a path of coordinates and navigate between them, using Google Maps or other apps?

This is a simple question.
I know it's possible to request to navigate to a specific place, as shown here.
I know there are also some other APIs for Google Maps (here and here), but I don't see an option to send multiple coordinates, to see the path between them, and navigate between them.
For the Web version, there is the ability for waypoints (example here and here), but not for Android.
Is it possible to do it, via Google Maps, or another app?
Or maybe even in the Google Maps API (within the current app) ?
Since V3 Google Maps Directions API support up to 23 waypoints (excluding the origin and destination) when calculating routes:
https://maps.googleapis.com/maps/api/directions/json?origin=sydney,au&destination=perth,au&waypoints=via:-37.81223%2C144.96254%7Cvia:-34.92788%2C138.60008&key=YOUR_API_KEY
So, you can draw polyline with up to 23 points and send they coords in request.
UPDATE:
Please see this tutorial.
UPDATE 2:
Example opening navigation mode of Google Maps app for route Tel-Aviv to Jerusalem via Kiryat Malakhi, Beit+Guvrin and geopoint (31.696342, 35.011337) via Intent:
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("https://www.google.com/maps/dir/?api=1&" +
"origin=3780+St+1,+Tel-Aviv+Yafo,+Israel&destination=Jerusalem,+Israel&travelmode=driving" +
"&waypoints=Kiryat+Malakhi,+Israel%7CBeit+Guvrin,+Israel%7C31.696342, 35.011337"));
startActivity(intent);
Result:
Parameter details here.

Is it possible to tell Android maps app to find path to a given coord

I'm trying to make an app that displays on a map the location of events, colleagues, appointments, etc. To this momento everything is fine, but now I was thinking of making it possible for the user to click the location and select a "guide me there" option, where it would open Android maps or another "pathfinding" app to the coords of that location. This because making a such a system on my app would surpass my capabilities and take a long time.
My question: is it possible to send an intent to Android maps to set travel to coords and if possible how?
AFAIK there is not an offical way to start the navigator, but
String address = google.navigation:q=yout+address+here;
Intent implicitIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(address));
startActivity(implicitIntent);
has worked for me

How do you send a Google Map API route to Android Navigator?

I started a project for a class a few semesters ago but never finished it because I could not find out how to do it! I got a B for the class, but it has been bothering me.
I am able to take YOUR location and map a route to various pre-decided locations (football fields) on your android: http://www.billynair.com/school/dgm3790/final/ (sorry, does not work on desktop yet) using the Google Maps API. It will show you the route and you can zoom in and out, but I want it to send to your device's Navigation app. I have asked around, searched until my fingers bled, and still no answers a year later.
Is there a way to send this API generated route to Android's Navigation app?
You can try the following. It should forward the coordinates you got to the default navigation app.
String tag = "google.navigation:q=" + the_latitude + "," + the_longitude;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(tag));
startActivity(intent);
However, this method appears to be totally unofficial and poorly documented.

Are there any map formats/standards and api's available to map local maps in android

I am trying to develop an app wherein I want to map a local map and then subsequently provide direction guidelines to my users depending on the same. I want this as an android app and hence looking for formats which I could use to map or create local maps.
Is anyone aware of such frameworks or formats?
some I came across are KML,GPX and KMZ .. any one who has done work on these to create localised maps.
You will get your answer in this link for displaying maps.
To show directions , use this intent
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://maps.google.com/maps?saddr="+source_latitude + ","+source_longitude+ "&daddr=" dest_latitude + ","dest_longitude));
mContext.startActivity(intent);

Starting Google Maps App with provided location and marker

From my app I would like to start the Google Maps App with a provided location and a marker. The marker should indicate, that there is something on that given location.
For now, I have the following code, which starts with an Intent the Google Maps App with the provided location (51.49234, 7.43045).
startActivity(
new Intent(
android.content.Intent.ACTION_VIEW,
Uri.parse("geo:51.49234,7.43045")));
When the Google Maps App starts, it looks like the following:
No marker is shown. I would like, that the Google Maps App would show a marker on that position, which is given through the Intent. Is there any "hidden" Intent URI's which I can use to show a marker within the Google Maps App?
Thanks in advance.
Solution
#Rajiv M. pointed me to the idea of querying the surroundings with the given location.
So, the solution is: Query the surroundings of your given location with your given location as the parameter. The URI looks like:
geo:51.49234,7.43045?q=51.49234,7.43045
Google Maps will show the query-result as the street name:
Kind of a hack, but it seems to work well.
Why you should not use 0,0 as the map location
geo:0,0?q=51.49234,7.43045
When you start Google Maps App with the provided map location point 0,0 , Google Maps App will start searching for your current device position. And this takes time. In some cases, when GPS signal is not provided, way too much. Until then the Google Maps App will start searching for your query 51.49234,7.43045.
Try starting Google Maps using the same intent, but with a URI of the format:
geo:34.067214,-118.349332?q=410+Hauser+Boulevard,+Los+Angeles,+CA
i.e. geo:0,0?q=street+address
The application should then actually show a point at that address. If you do not have the address, you may have to use a service to translate it to an address for this to work.
-
The other option is to embed a MapView in your application and add a marker within that. A tutorial for using MapViews / Markers with-in your application can be found at http://mobiforge.com/developing/story/using-google-maps-android.
Maybe you can try to put ur uri as below:
Uri uri =Uri.parse("http://maps.google.com/maps?q=" +_lat +","+_lon);
At least the above code work for me. It help me add a pin point on top of the location i search for. furthermore, the pin point will have a small dialog box to press on, it provide me the function of searching the direction to that location. :D

Categories

Resources