Android 谷歌地图,没有启动导航的选项,只有预览

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21777562/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 05:03:28  来源:igfitidea点击:

Google Maps, No Option for Starting the Navigation, Only Preview is there

androidgoogle-maps

提问by Gaurav Arora

In my application, I am starting the Google Navigation with the help of following set of code.

在我的应用程序中,我在以下代码集的帮助下启动了 Google 导航。

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

谢谢

回答by Joshua Lee

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."

当您使用 google.com 或 google 应用程序搜索位置时,然后点击路线按钮,起点和终点将传递到 google 地图应用程序。当您选择路线并且只看到预览选项时,这是因为 google.com/app 将一组起始坐标传递给地图应用程序,因此您要求 google 地图提供两点之间的方向,而不是您当前到某个点的位置。因此没有转弯。只需点击开始字段并选择当前位置,砰。”

回答by ChrisSwires

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 herewhich 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.

我唯一的建议是在传递给地图应用程序之前以某种方式检查导航实际上是否可用于给定的路线,如果没有,则向用户显示提示,但我不知道 android API足以在这里提供任何帮助。

A list of supported countries and territories is available here.

此处提供了支持的国家和地区列表。

Hope this helps.

希望这可以帮助。

回答by Akhilesh Mani

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.

在战斗的后期,我在我的应用程序实现中遇到了同样的问题,我无法使用 Google Map Client 查看实时导航。

At that time, Glympsecome 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:

那时,我开始使用Glympse,它是一种非常有效的方法,可以根据实时位置处理这些类型的场景。下面是一些实现代码:

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 SDKis 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.

整个Android SDK都在网站上给出,也给出了它的分步过程,试一试,让我知道它是否对你有帮助。

Thanks

谢谢

回答by Debi

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.

希望这是有道理的。

回答by The Godfather

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.

也许有点偏离主题,但这是搜索中唯一出现的主题。如果您正常使用 Google 地图(作为用户,即来自 Android 应用程序)并看到“预览”而不是导航,则可能是您所在的国家/地区 Google 不支持实时导航(叹气)。就我而言,它是科索沃,在那里您无法实时导航,只能在预览中手动导航。

Source: Google Maps Coverage

资料来源:谷歌地图覆盖范围