可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
In my application, I am starting the Google Navigation with the help of following set of code.
String uri = "http://maps.google.com/maps?saddr="+ gpsLatitude
+ "," + gpsLongitude
+ "&daddr="
+ updateAcceptedOfferDetailsData.getDestinationLat()+","+updateAcceptedOfferDetailsData.getDestinationLon();
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps",
"com.google.android.maps.MapsActivity");
startActivity(intent);
I am passing the Source Lat/Lng and Destination Lat/Lng of the respective addresses.
Problem:- Here my problem is when the Navigation Screen opens there is no option to "Start" rather there is another option "Preview", This problem do not happens at all the places it works fine for some places but not for all. May I know what the whole mess is??
Thanks
回答1:
This worked for me:
"To anyone who runs across this thread, I discovered the cause and solution to this issue in some cases.
When you search for a location using google.com or the google app, then tap the directions button, the start and end points are passed to the google maps app. When you select the route and only see the preview option, it's because google.com/app passed a starting set of coordinates to the maps app, so your asking google maps to provide directions between two points, not your current location to a point. Thus no turn-by-turn. Simply tap into the start field and select current location, bam."
回答2:
I have done some research on this and it appears that there is no way around it. The preview button will appear wherever navigation is not available for the requested route, the only reliable source I could find (Google was not massively helpful on this) to prove this is here which states (under navigation):
To launch turn-by-turn navigation, touch the Start navigation button represented by a chevron in the bottom right of the screen. When Navigation is not available, the icon will appear as a preview arrow , and you can view the directions step by step.
The only suggestion that I have would be to somehow check whether or not navigation is in fact available for the given route prior to passing to the maps application, and if not then display a prompt to the user, but I do not know the android API's well enough to be of any help here.
A list of supported countries and territories is available here.
Hope this helps.
回答3:
Little late in the battle, I was having same problem while my application implementation where I was unable to view real time navigations with Google Map Client.
At that time, Glympse come into my use and it is very much effective approach while dealing with these types of scenarios based upon real time locations. Here is some implementation code:
GTicketLite ticket = LiteFactory.createTicket(3600000, "Going home!", null);
// Set flags that adjust the presentation of the Glympse Send Wizard.
// These can enable/disable fields in the wizard screen.
final int WIZARD_FLAGS
= LC.SEND_WIZARD_INVITES_EDITABLE
| LC.SEND_WIZARD_MESSAGE_EDITABLE
| LC.SEND_WIZARD_DESTINATION_EDITABLE
| LC.SEND_WIZARD_TIME_EDITABLE;
// Launches the wizard which will send the Glympse
GGlympseLite glympse = GlympseLiteWrapper.instance().getGlympse();
glympse.sendTicket(ticket, WIZARD_FLAGS);
Whole Android SDK is given over the website and its step by step procedure is also given, Give it a try and let me know if it has helped you.
Thanks
回答4:
You can only navigate from where you are. If you are looking for a route from a different starting point to where you are at that current point in time you can only see a preview. As soon as you are at the starting location it will navigate.
Hope that makes sense.
回答5:
Maybe a bit off-topic, but that's the only topic coming up in search.
If you're using Google Maps normally (as a user, i.e. from Android app) and see "preview" instead of navigation, it could be that you're in the country where Google does not support real-time navigation (sigh). In my case, it was Kosovo, there you cannot navigate in real-time, only manually in preview.
Source: Google Maps Coverage