Android Maps Direction - android

I am looking to integrate Directions between a Lat, Long and the present location of the User. I would want at the click of the button to direct the user to the installed Google Maps/ Other Apps and show the directions.
I search SO and Google but couldn't find a good source and hence am posting this Question.
Tour Bangalore seems to be able to do it.
Couldnt find documentation on how to achieve this

There is no documented and supported Intent structure for this, sorry. You can bring up a map on a point, but not force Maps to obtain directions.
Also, bear in mind that:
not all devices have Google Maps
the user might not want to use Google Maps, even if it is installed (e.g., they bought some third-party mapping app that they wish to use)

The only official intents documented are given here. They do not include directions.
It has been noted that the following intent structure works with Google Maps. It seems the current Google Maps ingests the google maps http requests. It is probably the method used by the apps you've seen. However, it likely only works with Google Maps, and since it appears to be undocumented, there is no guarantee it will continue to work with future version of Google Maps.
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://maps.google.com/maps?daddr=33.881894,-92.199623&saddr=My+Location"));
where daddr is the destination location, and saddr is the source location. They can either be lat/lng's or search terms. "My+Location" is a search term in the above example, so it unlikely to work in locales with a language other than English.

Related

Plotting a GPS trail route on a Google map, embedding to site

New to Stackoverflow, did some searching and couldn't find anything that really matched what I'm looking for unless I'm using the wrong keywords. I did find guides on how to plot a route when you know the actual route, but I'm looking to do it from actually walking it, see below:
I'm fairly new to web development and am looking to plot maps of a trail on a website using an embedded Google map or some other free map platform if it's suitable (OSM?) I have an Android phone and I'd like to actually be able to:
(1) walk this route,
(2) take the GPS data somehow &
(3) match it up to a Google map to
(4) post it on my webpage.
That will help visitors know the actual route (which is not available on Google Maps in any detail) and have somewhat of a "guide" of the near-exact trail route. I imagine this can be done, as Runkeeper and other applications do this (with additional data on speed, time, etc.) for tracking your runs. I don't really want any of that additional data as much as I would like to just capture the GPS route itself, and have it in some format that I can then use to make a map out of automatically. Not sure where to start with this, or if it can be done easily. Any information or guidance would be greatly appreciated. I have no experience in Java; very limited Javascript and OK in HTML/CSS. I've never used the Google Maps API either.
Thanks!
You may use API Picker lists to help you on the most common things you may want to do on a map or with location-based data, and this also suggests the API that most suits your needs.
Listed below are the useful APIs to plot a route on a map:
Polylines in the Google Maps Android API
Polylines in the Google Maps SDK for iOS
Polylines in the Google Maps JavaScript API
Directions mode in the Google Maps Embed API
Paths in the Google Static Maps API (a web service)
Links of useful APIs for whatever you want to do on a map can be found in the documentation.

Is it possible to embed Google Navigation in an Android app?

I have an app which opens Google Maps from where the user is likely to start the Google Navigation from point A to B. Is it possible to open Google Maps and therefore Google Navigation only in specific proportion of the screen and display some additional (but minimal) information from my app next to the navigation?
I am thinking of something like this:
Additionally, is it possible to receive a broadcast when during the Google Navigation the user has arrived to her destination?
I know it is a bit far fetched, but maybe there are some ideas.
If you are still interested in knowing about this after 2 years.
Short answer: Yes (with a but).
If you are asking about displaying a full Navigation experience with turn by turn instructions, a puck, routines on Google Maps, then the answer is: It's illegal to do it without Google's permission. If you look at the Lyft app for drivers, they do have a full navigation experience on top of Google Maps because they partnered with them. So, it's possible, but requires direct communication with Google engineers.
For a workaround, you could show an embed Google Maps view in your apps, and show Markers, Polylines. They also have these APIs to get directions from one place to the other one. For example:
https://maps.googleapis.com/maps/api/directions/json?origin=Disneyland&destination=Universal+Studios+Hollywood4&key=<YOUR_API_KEY>
NOTE: Fees will apply when using these APIs. Check their documentation for more details about the workaround.
You can but you need to contact google personally this is google explanations about this subject and the contract page specially for your request https://cloud.google.com/maps-platform/ridesharing/
Not directly from Google map's navigation . But you can create your own by using
Direction API.
https://developers.google.com/maps/documentation/directions/start#sample-request
yes ,
you can use point an geography point by polygone and line canvas for routing the path between two point on google map.
for more reference reffer this Link.

Is it possible to create turn-by-turn GPS navigation app on Android/iOS using Google Maps?

Today I've talked to a client and he wants to build a simple navigation APP on Android!
Basically we could use Google maps, place some of "our" markers to show some locations (restaurants, hotels etc.) .. also we need to show user's friends near by!
Everything of that is possible in Google Maps API on Android, except I can not find any useful information about Turn-by-turn navigation implementation inside my own app (without switching to Google Maps App) ..
Can someone simply clarify - is it possible to use Google Maps inside an Android app to create turn-by-turn GPS based app?
thanks
I agree with the answer stated above but there is also a key clause in section 10.4.c of the google maps API privacy terms here.
It states
No navigation. You will not use the Service or Content for or in connection with (a) real-time navigation or route guidance; or (b) automatic or autonomous vehicle control.
Therefore I'd like to proceed and answer your question and say No, it is not possible to create a turn-by-turn navigation application on android by using Google Maps API without breaching their privacy policy.
Edit: Read answer by Tushar below before using this answer
First Option
If you want to implement the navigation completely in your app you will have to use a combination of the Google Maps API and the Google Directions API. They are free to use up to a limit and then you have to pay for the api requests.(https://developers.google.com/maps/documentation/directions/)
Second Option
I would just send the latitude and longitude of the location you want to navigate to the devices Maps app. Here is some code to start you off with this method:
double lat = < latitude of the location you want to navigate to>
double lng = < longitude of the location you want to navigate to>
String format = "geo:0,0?q=" + lat + "," + lng + "( Location title)";
Uri uri = Uri.parse(format);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
This will open the device's Maps app and plot the location and the user can use the app to do what ever they want.
I would go with the Second Option, it is stupidly easy to implement.
After searching a lot, I have found two options for turn-by-turn navigation with voice instructions and arrow images.
skobbler or sk maps (http://developer.skobbler.com/)
HERE Maps (https://developer.here.com/)
HERE Maps is somewhat costly and does not allow free usage (only 90 days of trial period). But it has lots of advantages like:
Clear and perfect documentation: The documentation they provide is clear and easily understandable, also the demo app they provide has all the required things implemented. So you can copy-and-paste many things.
Developer friendly: Full control of maps for developers (no restrictions, you can do anything that you can think of with maps).
Coverage: Navigation is not only clear and good for some specific countries, but for almost all countries. I have checked it in India for example. Apple Maps is not providing routes in India, Google Maps are providing it, but from my perspective, HERE Maps is much clearer and even better than Google.
skobbler is good and allows free usage up to a limit, but it's not good for all countries (not covering India up to level). Also it is not that much developer friendly as HERE Maps.
I stumbled upon this thread by searching for a turn-by-turn solution myself and I searched a bit further and found this promising javascript project:
FFWDme.js - is a JavaScript toolkit that aims to bring interactive GPS driving directions to the mobile browser
It's open source.
It's configurable, but by default it uses leaflet.js for slippy maps, and configurable Tile-server, so you could run it off Open-street maps. It also uses an opensource Graphhopper for direction services, but you can add your own.
Looks promising!
Creating turn by turn navigation using Google Maps API is not allowed in the Google Maps API ToS, even after the July 2018 pricing change where they updated their ToS.
From Google Maps new ToS section 3.2.3 (emphasis mine):
(d) No Re-Creating Google Products or Features. Customer will not use
the Services to create a product or service with features that are
substantially similar to or that re-create the features of another
Google product or service. Customer’s product or service must contain
substantial, independent value and features beyond the Google products
or services. For example, Customer will not: (i) re-distribute the
Google Maps Core Services or pass them off as if they were Customer’s
services; (ii) use the Google Maps Core Services to create a
substitute of the Google Maps Core Services, Google Maps, or Google
Maps mobile apps, or their features; (iii) use the Google Maps Core
Services in a listings or directory service or to create or augment an
advertising product; (iv) combine data from the Directions API,
Geolocation API, and Maps SDK for Android to create real-time
navigation functionality substantially similar to the functionality
provided by the Google Maps for Android mobile app.
I am late here but it would help someone, I found something on this context. Google providing In-app Navigation and Google Maps turn-by-turn directions support. It's paid, you can check more about this on below link.
https://cloud.google.com/maps-platform/rides-and-deliveries
Not sure if it solve your problem or not.
Not yet possible but google has some private partnerships
Lyft introduced google maps navigation in-app
https://www.theverge.com/2017/10/12/16465414/lyft-google-maps-waze-navigation-app-drivers

Obtaining deviations from set google maps route?

We would have all used the google maps app on android, so my question is little relevant to that.
In the gmaps for android app, when I choose a driving route, the route gets displayed on the map with voice and text commands. Suppose I deviate from that path, it recalculates the route and alerts me saying follow the original route.
So my question is, can we do this in the google maps API that is provided for android in our own app? If so what is the best followed approach.
My use case goes like this: I have a user who will start his journey to a set of client hotels, and if the transit he takes deviates I simply have to alert him saying he is following a wrong route or he has to follow the modified route. Kind of a security feature.

Android GPS navigation between 2 points

Can anyone point me in the direction of a tutorial on how to use GPS (Google maps) to navigate between 2 points in an Android app. I have searched for the last few hours and can only find
tutorials on pinpointing current location.
What I need to do is show current position on map, and then navigation to a set destination on map. So e.g. you are at point A - navigate to point Z
EDIT: Sorry but I should have clarified. What I want to do is just have a button in the app that the user clicks. Once clicked, Google Maps app open and from here Google can do the rest. I don't need the map to be displayed in my app at all.
There is no easy way to do it, you will need to get the direction from a location API such as Google Directions API or Cloudmade to give you all the way points between your 2 points.
you then however have to plot the path and then handle the voice controls yourself
you can however use and Intent to launch the google navigation app in the google maps app and just have google maps do everything but that does not sound like what you want
You can use a VIEW intent using standard google maps parameters. If Google Maps is installed on the device, the user will be able to choose to open it using that or the default browser, etc.
Unfortunately, there's no way to do this directly with a geo: intent at this time. In any of my mapping applications, I've given up bothering with geo: because it's just not mature or standardized enough.
For a great list of url parameters to use(including "directions" mode), check out Everything You Never Wanted to Know About Google Maps' Parameters. I keep it bookmarked.

Categories

Resources