如何获得何时使用Google Maps的通知? [英] How to get notified when to turn using Google Maps?

查看:89
本文介绍了如何获得何时使用Google Maps的通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Android移动应用程序中,用户指向他想去的地方,然后由Google地图生成路径. Google地图告诉我,例如,现在戴夫"这个家伙必须转身.我该怎么办?

In my mobile app on android, user points a place where he wants to go and the path is then generated by google maps. I need to be told by Google Maps that, for example, right now that guy 'Dave' will have to turn. How would I do that?

推荐答案

首先,您应该了解Google Maps Platform服务条款对创建实时导航或逐行导航有某些限制.基本上,您不允许在您的应用程序中创建此类功能.

First of all you should be aware that Google Maps Platform Terms of Service have certain restrictions regarding creation of real-time or turn-by-turn navigation. Basically, you are not allowed to create such functionality in you app.

请参阅ToS的第3.2.4节禁止滥用服务的限制".在(c)段中,您将找到以下内容

Have a look at section 3.2.4 'Restrictions Against Misusing the Services' of ToS. In paragraph (c) you will find the following

不得重新创建Google产品或功能.客户不得使用服务来创建具有与其他Google产品或功能基本相似或具有相同功能的产品或服务.服务...

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

例如,客户不会:...

For example, Customer will not: ...

(iv)结合来自Directions API,Geolocation API和Android版Maps SDK的数据,以创建与Google Maps for Android移动应用程序所提供功能基本相似的实时导航功能.

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

来源: https://cloud.google.com/maps-平台/条款/#3-许可证

这意味着,根据服务条款,唯一允许的选项是将用户重定向到Google Maps应用,以便他们可以使用导航模式.

That means that the only allowed option according to the ToS is redirect your users to Google Maps app where they can use navigation mode.

您应该创建一个在导航模式下打开Goog​​le Maps本机应用程序的意图.有一个Google Maps URL,它可以构造一个通用的跨平台URL,以从您的应用程序启动Google Maps Intent.您可以按照以下文档打开本机应用程序的导航模式:

You should create an intent that opens the Google Maps native app in navigation mode. There is a Google Maps URLs that allows to construct a universal, cross-platform URL to launch Google Maps intents from your application. You can open navigation mode of native app following this documentation:

https://developers.google.com/maps/documentation /urls/guide#directions-action

代码快照可能是

String url = "https://www.google.com/maps/dir/?api=1&destination=Madrid,Spain&origin=Barcelona,Spain&waypoints=Zaragoza|Huesca&travelmode=driving&dir_action=navigate";           
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent); 

希望这会有所帮助!

这篇关于如何获得何时使用Google Maps的通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆