public class AMapNavi
extends java.lang.Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
SLOPE_TYPE_DOWN |
static int |
SLOPE_TYPE_UP |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addAimlessModeListener(AimlessModeListener listener)
注册巡航模式信息回调监听
注意:该接口仅驾车模式有效
Register aimless mode information callback listener Note: This interface is only valid for driving mode. |
void |
addAMapNaviListener(AMapNaviListener naviListener)
添加导航事件回调监听。
|
void |
addParallelRoadListener(ParallelRoadListener listener)
添加平行路切换监听,包括主辅路切换和高架上下切换
注意:该接口仅驾车模式有效
Add parallel road switch listener, including main auxiliary road switching and overpass up-down switching Note: This interface is only valid for driving mode. |
static void |
addTTSInitializeListener(TTSInitializeListener ttsInitializeListener)
添加内置语音初始化监听
"Add a built-in voice initialization listener." |
void |
addTTSPlayListener(TTSPlayListener listener)
添加内置语音播报监听
Add built-in TTS playback listener |
boolean |
calculateDriveRoute(java.util.List<NaviLatLng> to,
java.util.List<NaviLatLng> wayPoints,
int strategy)
计算驾车路径(不带起点,起点默认为当前位置)
Calculate the driving route without specifying the starting point, which defaults to the current location. |
boolean |
calculateDriveRoute(java.util.List<NaviLatLng> from,
java.util.List<NaviLatLng> to,
java.util.List<NaviLatLng> wayPoints,
int strategy)
计算驾车路径(包含起点)
Calculate the driving route including the starting point. |
boolean |
calculateDriveRoute(NaviPoi fromPoi,
NaviPoi toPoi,
java.util.List<NaviPoi> wayPoints,
AMapNaviCalRouteOptions calRouteOptions)
算路参数支持传option,方便扩展算路参数
Routing parameters support passing options for easy extension of routing parameters AMapNaviCalRouteOptions 当前支持设置 strategy 和 invoker,后期按需要增加字段 |
boolean |
calculateDriveRoute(NaviPoi fromPoi,
NaviPoi toPoi,
java.util.List<NaviPoi> wayPoints,
int strategy)
驾车POI算路
Driving POI route calculation. |
boolean |
calculateDriveRoute(NaviPoi fromPoi,
NaviPoi toPoi,
java.util.List<NaviPoi> wayPoints,
int strategy,
AMapCalculateRouteListener listener) |
boolean |
calculateDriveRoute(java.lang.String toPoiId,
java.util.List<java.lang.String> wayPointIds,
int strategy)
计算驾车路径(不带起点,起点默认为当前位置)。
|
boolean |
calculateDriveRoute(java.lang.String fromPoiId,
java.lang.String toPoiId,
java.util.List<java.lang.String> wayPoints,
int strategy)
计算驾车路径(包含起点)
Calculates the driving route including the starting point. |
boolean |
calculateDriveRouteWithMultiEnd(NaviPoi from,
java.util.List<NaviLatLng> to,
java.util.List<NaviPoi> wayPoints,
int strategy)
计算驾车路径(多终点)。
|
boolean |
calculateDriveRouteWithMultiPoints(java.util.List<NaviLatLng> from,
java.util.List<NaviLatLng> to,
java.util.List<NaviPoi> wayPoints,
int strategy)
计算驾车路径(多起点,多终点)。
|
boolean |
calculateDriveRouteWithMultiStart(java.util.List<NaviLatLng> from,
NaviPoi to,
java.util.List<NaviPoi> wayPoints,
int strategy)
计算驾车路径(多起点)。
|
boolean |
calculateEleBikeRoute(NaviLatLng to)
骑行(电动车)经纬度算路 (不带起点,默认为当前位置)
Electric bicycle route calculation based on latitude and longitude (without a specified starting point, defaults to current position). |
boolean |
calculateEleBikeRoute(NaviLatLng from,
NaviLatLng to)
骑行(电动车)经纬度算路
Electric bicycle route calculation based on latitude and longitude. |
boolean |
calculateEleBikeRoute(NaviPoi fromPoi,
NaviPoi toPoi,
TravelStrategy strategy)
骑行(电动车)POI算路
Calculate electric bike route based on POIs. |
boolean |
calculateOptimalRouteOnNavigating()
导航中计算更优路线(非导航态无效)
Calculating optimal route during navigation (invalid when not navigating) 注意:该接口仅MPID还原路线场景有效 "This API is specifically designed for the MPID route reconstruction scenario." |
boolean |
calculateRideRoute(NaviLatLng to)
骑行(自行车)经纬度算路 (不带起点,默认为当前位置)
Cycling (bicycle) route calculation based on latitude and longitude (without starting point, defaulting to current position). |
boolean |
calculateRideRoute(NaviLatLng from,
NaviLatLng to)
骑行(自行车)经纬度算路 (包含起点)。
|
boolean |
calculateRideRoute(NaviPoi fromPoi,
java.util.List<NaviPoi> wayPoints,
NaviPoi toPoi,
TravelStrategy strategy)
骑行(自行车)POI算路 特别注意:当前接口为收费接口,您如果申请试用或者正式应用都请通过工单系统提交商务合作类工单进行沟通 https://lbs.amap.com/
Cycling (bicycle) route calculation via POIs. |
boolean |
calculateRideRoute(NaviPoi fromPoi,
NaviPoi toPoi,
TravelStrategy strategy)
骑行(自行车)POI算路
Calculate route using POIs for cycling (bicycle). |
boolean |
calculateWalkRoute(NaviLatLng to)
计算步行路径(不带起点,默认为当前位置)。
|
boolean |
calculateWalkRoute(NaviLatLng from,
NaviLatLng to)
计算步行路径(包含起点)。
|
boolean |
calculateWalkRoute(NaviPoi fromPoi,
java.util.List<NaviPoi> wayPoints,
NaviPoi toPoi,
TravelStrategy strategy)
步行POI算路 特别注意:当前接口为收费接口,您如果申请试用或者正式应用都请通过工单系统提交商务合作类工单进行沟通 https://lbs.amap.com/
Walking POI routing note: This interface is currently a paid service. |
boolean |
calculateWalkRoute(NaviPoi fromPoi,
NaviPoi toPoi,
TravelStrategy strategy)
步行POI算路
Calculate walking route using POIs |
int |
calculateWalkRouteReturnRequestId(NaviLatLng to) |
void |
clearAvoidAreas(AMapCarInfo carInfo)
清除避让区域
Clear avoidance area |
void |
clearMpid()
已过时。
|
void |
clearMpidRestoreOption()
清空设置的mpid 和mpid_restore_type(路线还原类型) 驾车货车都清除
Clear the set mpid and mpid_restore_type (route restoration type), both driving and truck modes will be cleared 注意:需要在停止导航或者到达终点时,主动清空mpid,否则会影响下次的路线规划结果 Note:"The mpid must be cleared when navigation is stopped or the destination is reached; otherwise, it may affect the next route planning results." |
void |
configXMLElementAttrib(int calculateType,
java.lang.String elementName,
java.util.Map<java.lang.String,java.lang.String> attributes)
算路接口请求数据中指定节点下添加属性值
多属性同时添加
如果在xml中修改的节点已包含Map中的属性,则会修改此属性值为最新状态
Add attribute values under specified nodes in the routing interface request data Multiple attributes can be added simultaneously If the modified node already contains properties from the Map in XML, it will update the property value to the latest state |
void |
configXMLElementAttrib(int calculateType,
java.lang.String targetElementName,
java.lang.String attributeName,
java.lang.String attributeValue)
算路接口请求数据中指定节点下添加属性值
单条属性添加
如果在xml中修改的节点已包含attributeName属性,则会修改此属性值为最新状态
Adds attribute values under specified nodes in the routing interface request data Single attribute addition If the modified node in xml already includes the attributeName attribute, it will update the attribute value to the latest state |
boolean |
delateCustomXMLElement(int calculateType,
java.lang.String targetElementName,
java.lang.String subElementName)
删除指定节点
Delete the specified node |
boolean |
delateCustomXMLElementAttrib(int calculateType,
java.lang.String targetElementName,
java.lang.String attributeName)
删除在该节点下添加的属性值
Delete the added attribute values under this node |
static void |
destroy()
释放导航对象资源
Release the resources of the navigation object. |
static int |
getAppLang() |
static AudioOutputMode |
getAudioOutputMode()
获取当前TTS播报类型
Get current TTS broadcast mode |
int |
getBroadcastMode()
获取设置的播报模式,设置播报模式都从该处获取值,控制UI
|
AMapCarInfo |
getCarInfo() |
int |
getControlMusicVolumeMode()
获取导航语音播报混合音状态
Get the status of mixed sound for navigation voice announcements |
static java.lang.String |
getDeviceId(Context context)
获取设备唯一ID,使用导航SDK的时候建议使用这个作为设备唯一ID
Get the unique device ID, when using the navigation SDK, it is recommended to use this as the unique device ID |
int |
getEngineType()
获得导航引擎类型
Get navigation engine type. |
static FullLinkLogCallback |
getFullLinkLogCallback()
获取全链路日志监听器
Get full link log listener |
static AMapNavi |
getInstance(Context context)
创建一个AMapNavi导航对象
Create an instance of the AMapNavi navigation object. |
boolean |
getIsNaviTravelView()
已过时。
|
boolean |
getIsUseExtraGPSData()
获取是否使用外部定位数据
Get whether external positioning data is being used |
boolean |
getIsUseInnerVoice()
获取是否使用内部语音播报
Get whether internal voice announcements are used |
boolean |
getListenToVoiceDuringCall()
获取当前通话过程中是否进行导航播报(只在使用内置语音时生效)
Get whether navigation announcements occur during calls (only effective when using built-in voice) |
int |
getMinSlopeAngle() |
int |
getMinSlopeLength() |
void |
getMpidWithNaviRoutes(java.util.List<AMapNaviPath> routes,
AMapNaviMpidOption option,
GenerateMpidCallback observer)
使用 SDK 规划出的路线和自定义选项获取 mpid。
|
java.util.List<AMapNaviGuide> |
getNaviGuideList()
已过时。
请使用
AMapNaviPath.getNaviGuideList()Deprecated: Use AMapNaviPath.getNaviGuideList() instead |
static java.lang.String |
getNaviLocation() |
AMapNaviPath |
getNaviPath()
获取当前规划的路线方案(路线结果),驾车、骑行与步行共用这一个对象
Get the currently planned route plan (route result), which is shared among driving, cycling, and walking modes. |
java.util.HashMap<java.lang.Integer,AMapNaviPath> |
getNaviPaths()
获取计算的多条路径
Get multiple calculated routes |
AMapNaviResourceProxy |
getNaviResourceProxy() |
NaviSetting |
getNaviSetting()
获取导航配置类
Get navigation settings class |
int |
getNaviType()
获取导航位置变化驱动类型
Get the type of navigation location change driver. |
java.lang.String |
getPushDataNaviVersion()
获取路线还原数据的支持导航版本号
Get the supported navigation version number for route restoration data |
boolean |
getRestrictareaInfo(AMapNaviPath path,
AMapNaviRestrictAreaInfoListener observer)
获取现行信息数据
Get current traffic information data |
java.lang.String |
getRouteSdkVersion()
获取算路引擎版本号
Get the routing engine version number |
java.lang.String |
getRouteVersion()
获取服务下发协议的版本号
Get the version number of the service protocol issued |
boolean |
getServiceAreaDetailsEnable()
是否开启服务区详情开关
Whether to turn on the service area detail switch |
java.lang.String |
getServiceAreaSlopeShowFields()
获取设置过的请求路线上服务区,坡度数据类型
|
int |
getSlopeType() |
java.util.List<AMapTrafficStatus> |
getTrafficStatuses(int startPos,
int distance)
已过时。
已废弃,请使用
AMapNaviPath.getTrafficStatuses()Deprecated, please use AMapNaviPath.getTrafficStatuses() |
AMapTravelInfo |
getTravelInfo() |
static TTSInitializeListener |
getTTSInitializeListener()
获取内置语音初始化监听
Get built-in voice initialization monitoring |
static AMapTtsOption |
getTTSOption()
获取TTS配置选项
Get TTS configuration options |
static java.lang.String |
getVersion()
获取版本号
Get version number |
boolean |
independentCalculateRoute(NaviPoi fromPoi,
NaviPoi toPoi,
java.util.List<NaviPoi> wayPoints,
int transportType,
AMapNaviIndependentRouteListener observer,
AMapNaviCalRouteOptions calRouteOptions)
POI独立算路 SDK9.4.0版本开始支持骑步行途径点算路,骑步行添加途径点算路为付费接口。
|
boolean |
independentCalculateRoute(NaviPoi fromPoi,
NaviPoi toPoi,
java.util.List<NaviPoi> wayPoints,
int strategy,
int transportType,
AMapNaviIndependentRouteListener observer)
POI独立算路 SDK9.4.0版本开始支持骑步行途径点算路,骑步行添加途径点算路为付费接口。
|
void |
insertXMLElement(int calculateType,
java.lang.String targetElementName,
java.util.Map<java.lang.String,java.lang.String> subElementMap)
算路接口请求数据中指定节点下添加多个子节点
Adds multiple child nodes under specified nodes in the routing interface request data |
void |
insertXMLElement(int calculateType,
java.lang.String targetElementName,
java.lang.String subElementName,
java.lang.String subElementValue)
在算路接口请求数据中的指定节点下添加单个子节点
Add a single child node under the specified node in the routing interface request data |
static boolean |
isDestroyed()
是否为销毁态
Whether it is in destroyed state |
boolean |
isGpsReady()
获取手机卫星定位是否准备就绪
Check if mobile satellite positioning is ready |
boolean |
isNaviParkEnabled()
园区导航是否已经开启
Is the campus navigation already enabled |
static boolean |
isNaviStarted()
已过时。
请使用
getNaviType()Deprecated, please use getNaviType() instead. |
static boolean |
isTtsPlaying()
当前SDK内置语音的是否正在播报
Whether the built-in TTS of the current SDK is broadcasting. |
boolean |
navigationWithOptimalRoute()
导航中,切换到更优路线导航
"During navigation, switch to a more optimal route." |
static void |
occupyLocManager()
【内部】持有导航,调用后不会销毁导航
[Internal] Hold the navigation, calling it will not destroy the navigation |
void |
pauseNavi()
暂停导航,仅支持模拟导航
Pause navigation, only supports simulated navigation. |
boolean |
playTTS(java.lang.String tts,
boolean forcePlay)
播放自定义文字,注意如果当前正在播放导航语音,可能导致播放失败,只在内置语音下生效
Play custom text, note that if the navigation voice is currently playing, it may cause playback failure, effective only under built-in voice |
boolean |
pushDriveRouteWithData(byte[] routeData,
NaviPoi start,
NaviPoi end,
java.util.List<NaviPoi> wayPois,
int strategy)
注意:该接口仅驾车模式有效
Note: This interface is valid only for driving mode. |
boolean |
pushRouteGuideWithData(JSONObject serverData,
NaviPoi start,
NaviPoi end,
java.util.List<NaviPoi> wayPois,
int strategy)
注意:该接口仅驾车模式有效
Note: This interface is valid only for driving mode. |
boolean |
pushRouteGuideWithData(JSONObject serverData,
NaviPoi start,
NaviPoi end,
java.util.List<NaviPoi> wayPois,
int strategy,
AMapCalculateRouteListener listener) |
void |
pushTrajectoryRestoration(Context context,
java.util.List<com.amap.api.maps.model.LatLng> points,
java.util.List<com.amap.api.maps.model.LatLng> wayPoints,
java.lang.String vehicleType,
java.lang.String strategy,
TrajectoryRestorationTaskCallback taskCallback)
轨迹还原
|
boolean |
readNaviInfo()
触发一次导航播报提示
Trigger one navigation announcement prompt. |
boolean |
readTrafficInfo(int frontDistance)
触发一次前方路况播报
Trigger a road condition broadcast ahead once. |
boolean |
reCalculateRoute(int strategy)
导航过程中重新规划路线(起点为当前位置,途经点、终点位置不变)
Re-plan the route during navigation (the starting point is the current location, passing points and destination remain unchanged) |
int |
reCalculateRouteReturnRequestId(int strategy) |
void |
refreshNaviInfo()
立即触发一次导航引导信息回调
注意:该接口仅驾车模式有效
Immediately trigger a navigation guidance information callback Note: This interface is only valid for driving mode. |
static void |
releaseLocManager()
【内部】释放导航持有,释放后,导航才可以销毁
[Internal] Release the navigation hold, after releasing, the navigation can be destroyed |
void |
removeAimlessModeListener(AimlessModeListener listener)
移除巡航模式信息回调监听
注意:该接口仅驾车模式有效
Remove aimless mode information callback listener Note: This interface is only valid for driving mode. |
void |
removeAMapNaviListener(AMapNaviListener naviListener)
移除导航对象的监听
Remove the listener from the navigation object. |
void |
removeParallelRoadListener(ParallelRoadListener listener)
移除平行路切换监听,包括主辅路切换和高架上下切换
注意:该接口仅驾车模式有效
Remove parallel road switch listener, including main auxiliary road switching and overpass up-down switching Note: This interface is only valid for driving mode. |
void |
removeTTSPlayListener(TTSPlayListener listener)
移除内置语音播报监听
Remove built-in TTS playback listener |
void |
resumeNavi()
继续导航,仅支持模拟导航
Resume navigation, only supports simulated navigation. |
void |
selectMainPathID(long pathId)
导航中选主路线(只有在多备选路线模式下才生效)
Select main route during navigation (only effective in multi-alternative route mode) 注意:该接口仅驾车模式有效 Note: This interface is only valid for driving mode. |
boolean |
selectRouteId(int id)
导航前选主路线
Select main route before navigation. |
void |
setAllowReCalcRouteWhenMpidRestoreFail(boolean allow)
设置当mpid还原路线失败之后,是否允许使用传入的起终点重新算路, 默认值:true, 允许重新算路
Configure whether to allow recalculation using the provided start and end points when mpid route restoration fails, default value: true, allowing recalculation |
void |
setAMapNaviOnlineCarHailingType(AMapNaviOnlineCarHailingType type)
设置网约车导航模式,包括非网约车模式,网约车接驾模式、网约车送驾模式,默认为非网约车模式
Set online car-hailing navigation mode, including non-online car-hailing mode, pick-up mode, drop-off mode, default is non-online car-hailing mode. |
void |
setAMapRouteOptimalParams(AMapRouteOptimalParams optimalParams)
导航中计算更优路线参数
Calculating optimal route parameters during navigation 注意:该接口仅针对MPID还原路线场景 "This API is specifically designed for the MPID route reconstruction scenario." |
static void |
setApiKey(Context context,
java.lang.String apiKey)
手动设置key,这是个静态方法,需要在一切导航接口前调用,建议在applicaiton中调用
Manually set the key, this is a static method, needs to be called before all navigation interfaces, it's recommended to call it in the application. |
static void |
setAppLang(Context context,
AMapNaviAppLangOptions aMapNaviAppLangOptions,
AudioAuthTaskCallback audioAuthTaskCallback)
设置app语言类型, 要确保AMapNavi创建前设置
Set app language type, ensure AMapNavi is created before setting |
static void |
setAudioOutputMode(AudioOutputMode audioMode) |
boolean |
setAvoidAreas(AMapCarInfo carInfo,
java.util.List<java.util.List<NaviLatLng>> avoidAreas)
设置避让区域信息,最多支持100个区域,每个区域最多支持16个顶点,超出限制会导致设置不生效
Set avoidance area information, supporting up to 100 areas with a maximum of 16 vertices per area. |
boolean |
setBroadcastMode(int mode)
设置语音播报模式为"专家模式"还是"新手模式"【驾车有效】,导航中设置需要下次算路才生效,如偏航或刷新重算
Set voice broadcast mode to "Expert Mode" or "Beginner Mode" [valid for driving], settings during navigation take effect after recalculating the next route, such as rerouting or refreshing recalculation. |
void |
setCameraInfoUpdateEnabled(boolean enable)
已过时。
已废弃,新引擎机制不再支持单播报模块控制
Deprecated, new engine mechanisms no longer support single module control for announcements |
void |
setCarInfo(AMapCarInfo carInfo)
设置车辆信息(包括车型,车牌,车高,车重等),路径规划时会躲避车辆限行区域和路线
Set vehicle information (including vehicle type, license plate, height, weight, etc.), and during path planning, it will avoid areas and routes where the vehicle is restricted. |
void |
setConnectionTimeout(int connectionTimeOut)
设置建立连接超时时间,单位毫秒级,最低3000,默认10000
Set the timeout for establishing a connection, unit in milliseconds, minimum 3000, default 10000. |
void |
setControlMusicVolumeMode(int controlMusicVolumeMode)
设置导航播报时压低音乐、暂停音乐,只有在使用内置语音时生效(Android8.0以下系统不支持暂停音乐,设置暂停音乐无效)
Set the volume mode for music when navigating, only effective when using internal voice (systems below Android 8.0 do not support pausing music, setting pause music is ineffective) |
void |
setCPOrderId(java.lang.String cpOrderId)
设置共享订单ID
Set shared order ID |
void |
setCPProduct(java.lang.String cpProduct)
设置共享产品唯一ID
Set unique ID for shared product |
void |
setCustomNaviParkLimitInfo(AMapNaviParkLimitInfo limitInfo)
设置自定义园区信息,包括:自定义限速、超速文案等。
|
void |
setCustomPosControlConfig(java.lang.String posConfig)
【二环专用】设置自定义pos功能配置
【Exclusive for ErHuan】Set custom POS function configuration |
static boolean |
setCustomPosControlEnable(boolean enable)
【二环专用】设置是否启用pos功能自定义配置
【Exclusive for ErHuan】Set whether to enable custom configuration for POS function |
void |
setEmulatorNaviSpeed(int speed)
设置模拟导航的速度
Set the simulated navigation speed. |
void |
setExtraGPSData(int type,
Location location)
此方法用于设置外部定位数据,并使用外部定位数据进行导航
This method sets external positioning data and navigates using it. |
static void |
setFullLinkLogCallback(FullLinkLogCallback callback)
设置全链路日志回调监听
Set full link log callback listener |
void |
setGpsWeakDetecedInterval(long delayTime)
已过时。
此接口已失效
This interface is deprecated. |
void |
setHazardousChemicals(boolean isHazardousChemicals)
设置是否危化品车辆(仅对货车算路生效) true:危化品;false:非危化品 默认值false
"Set whether the vehicle is a hazardous material vehicle (applies only to truck route calculations). true: hazardous material; false: non-hazardous material. |
void |
setIgnoreRestriction(boolean isIgnore)
设置是否忽略非物理限行,仅对货车算路生效, 需要在路径规划之前设置。
|
void |
setInnerOptRecordEnable(java.lang.String key)
【二环专用】设置是否启用OPT日志记录
【Special for ErHuan】Set whether to enable OPT log recording |
void |
setIsInsidePrivatePark(boolean isInside)
设置是否已经进入园区内,设置进入园区后,园区内限制信息才会生效
"Set whether the user is inside the campus. |
void |
setIsNaviTravelView(boolean isTravel)
已过时。
|
void |
setIsOpenTrafficLight(java.lang.String key)
设置是否显示红绿灯倒计时
Set whether to display traffic light countdown |
void |
setIsUseExtraGPSData(boolean isUseExtraData)
设置是否使用外部定位数据
Set whether to use external GPS data. |
void |
setLabelId(java.lang.String labelId)
【网约车】设置本次算路标记id,在路线结果中可以获取对比,是否是同次算路
[Ride-hailing] Sets the ID for the current route calculation mark, which can be used to compare in the route results to determine if it's from the same calculation session |
void |
setListenToVoiceDuringCall(boolean isListenToVoiceDuringCall)
设置在通话过程中是否进行导航播报,只有在使用内置语音时生效
Set whether navigation announcements should occur during calls, effective only when using built-in voice |
void |
setMpid(java.lang.String mpid)
已过时。
|
void |
setMpidRestoreOption(AMapNaviMpidRestoreOption option)
设置mpid还原,需要在导航规划路线之前设置,驾车、货车都支持
Set mpid restore, it needs to be set before planning the navigation route, and it supports both cars and trucks 如果添加了mpid进行算路导航,导航停止或者销毁时需要调用 clearMpidRestoreOption()移除mpid,否则会影响后续算路的结果。 |
void |
setMultipleRouteNaviMode(boolean multipleRouteNaviMode)
设置多路线导航模式(导航中拥有若干条备选路线供用户选择), 或单路线导航模式(默认模式)
Set multi-route navigation mode (with several alternative routes available for users to choose from) or single route navigation mode (default mode). |
static void |
setNaviLocation(java.lang.String naviLocation) |
void |
setNaviNetworkProxy(AMapNaviNetWorkProxy proxy)
设置导航外部网络代理类
Set navigation external network proxy class |
void |
setNaviParkEnabled(boolean isEnabled)
设置是否开启园区导航, 默认值- false:关闭
"Set whether to enable campus navigation. |
void |
setNaviResourceProxy(AMapNaviResourceProxy proxy)
设置导航外部资源代理类
Set up the navigation external resource proxy class. |
static void |
setNetWorkingProtocol(NetWorkingProtocol protocol)
设置网络请求协议
Set network request protocol. |
void |
setNewExtraGPSData(int type,
com.amap.api.location.AMapLocation aMapLocation)
此方法用于新定位sdk涉及设置外部定位数据,并使用外部定位数据进行导航
使用此方法前需要先调用
setIsUseExtraGPSData(boolean)将开关打开. |
void |
setOnlineCarHailingXML(java.lang.String elementContent)
【网约车】设置路线elementContent
[Ride-hailing] Set route element content |
void |
setOrderStatus(int orderStatus)
设置订单状态
Set order status |
void |
setSCTXPassangerAdiu(java.lang.String passangerAdiu)
设置乘客 passanger_adiu
Set passenger passanger_adiu |
void |
setServiceAreaDetailsEnable(boolean enable)
设置服务区详情是否打开,打开后组件会显示服务区UI,API会返回服务区类型信息
Set whether to open service area details, after opening, the component will display the service area UI, and the API will return the type information of the service area. |
void |
setServiceAreaSlopeShowFields(java.lang.String[] showFilds)
设置请求路线上服务区,坡度数据,具体返回的数据根据传入的数组返回对应值
String数组传入方便扩展[slope_info,service_area,slope_broadcast_info,service_area_shape]
该功能需要联系商务开通,开启该功能旧接口服务区详情自动打开,数组中元素推荐通过
中获取 |
void |
setShareBizScene(boolean isShareBizScene)
设置是否共享业务
Set whether to share business |
void |
setSlopeFilter(int minSlopeLength,
int minSlopeAngle,
int slopeType)
设置坡度请求过滤条件,返回该条件过滤后的信息
|
void |
setSoTimeout(int soTimeOut)
设置服务器返回超时时间,单位毫秒级,最低3000,默认10000
Set server response timeout time, unit in milliseconds, minimum 3000, default 10000. |
void |
setSpeechRate(Context context,
float speechRate)
设置内置语音播报速率
取值范围 0~2
默认值1.0,值越大语速越快
|
void |
setTrafficInfoUpdateEnabled(boolean enable)
设置是否打开移动交通台功能
Set whether to open the mobile traffic station function. |
void |
setTrafficSignalEnable(boolean enable)
已过时。
自10.0.2 废弃
Deprecated since 10.0.2 |
void |
setTrafficStatusUpdateEnabled(boolean enable)
设置交通状态是否更新
Set whether to update traffic status. |
void |
setTravelInfo(AMapTravelInfo travelInfo)
设置骑步行信息(骑行、步行)
Set cycling or walking information. |
void |
setTruckMultipleRouteNaviMode(boolean truckMultipleRouteNaviMode)
设置货车多路线导航模式(导航中拥有若干条备选路线供用户选择), 或单路线导航模式(默认模式)
Set the multi-route navigation mode for trucks (where there are several alternative routes available for users to choose from) or single route navigation mode (default mode) 注意:此方法仅限于在开始导航前调用有效,步行与骑行导航无效,以下情况不会出现多备选路线:模拟导航、路线存在途经点、路线长度超过80KM。 |
static void |
setTTSOption(AMapTtsOption ttsOption)
设置TTS配置选项
Set TTS configuration options |
static void |
setTtsPlaying(boolean playing)
设置外部播放器是否正在播报
Set whether the external player is currently broadcasting. |
void |
setUseInnerVoice(boolean isUseInnerVoice)
已过时。
|
void |
setUseInnerVoice(boolean isUseInnerVoice,
boolean isCallBackText)
设置使用内部语音播报
Set internal voice announcement usage |
void |
startAimlessMode(int aimlessMode)
设置在巡航模式(无路线规划)的状态下,智能播报的类型
Set the type of smart announcements in cruise mode (without route planning). |
boolean |
startGPS()
启动手机卫星定位
Start satellite positioning on the phone. |
boolean |
startGPS(long interval)
启动手机卫星定位, 带定位时间间隔参数
Activate mobile satellite positioning with timing interval parameter. |
boolean |
startGPS(long time,
int dis)
已过时。
请使用
startGPS(long)
Use startGPS(long) instead. |
boolean |
startNavi(int naviType)
开始导航。
|
boolean |
startNaviWithPath(int naviType,
AMapNaviPathGroup pathGroup)
使用指定路线开始导航
Start navigation using a specified route |
void |
startSpeak()
开始内置语音播报,只有在使用内置语音的情况下才有效
Start internal voice broadcast, effective only when using internal voice |
void |
stopAimlessMode()
停止巡航模式
Stop cruise mode.
|
boolean |
stopGPS()
停止手机卫星定位
Stop mobile satellite positioning. |
void |
stopNavi()
停止导航,包含实时导航和模拟导航
Stop navigation, including real-time navigation and simulated navigation. |
void |
stopSpeak()
停止内置语音播报,只有在使用内置语音的情况下有效
Stop internal voice broadcast, effective only when using internal voice. |
int |
strategyConvert(boolean avoidCongestion,
boolean avoidHighway,
boolean avoidCost,
boolean prioritiseHighway,
boolean multipleRoute)
进行算路策略转换,将传入的特定规则转换成PathPlanningStrategy的枚举值
Perform route planning strategy conversion, converting the specific rules passed into enum values of PathPlanningStrategy. |
void |
switchParallelRoad()
已过时。
|
void |
switchParallelRoad(int parallelType)
切换平行路,目前支持主辅路和高架上下切换
Switch parallel roads, currently supports main and auxiliary road switching and overpass up and down switching. |
public static final int SLOPE_TYPE_UP
public static final int SLOPE_TYPE_DOWN
public static AMapNavi getInstance(Context context) throws com.amap.api.maps.AMapException
context - 对应的Contextcom.amap.api.maps.AMapExceptionpublic static java.lang.String getVersion()
public static void setApiKey(Context context,
java.lang.String apiKey)
context - 对应的ContextapiKey - 用户在高德官网申请的KEYpublic static void setTtsPlaying(boolean playing)
如果正在播报语音,请设置为true,如果没有在播报语音,请设置false;如一直设置true,SDK内部会认为外界一直在播报,
那么AMapNaviListener.onGetNavigationText(int, String),就会一直不触发,导致无文字吐出;
如一直设置false,文字吐出的频率可能会过快,会出现语句打断情况,所以请根据实际情况设置。
AMapNaviListener.onGetNavigationText(int, String) will not trigger, resulting in no text output;
if consistently set to false, the frequency of text output might be too fast, causing interruptions in sentences, so please adjust based on actual conditions.
playing - true-外部播放器正在播报中,false-外部播放器空闲中public static boolean isTtsPlaying()
注意:正在播报的时候请不要使用外部播放器播报语音,会导致与导航内置的播报冲突。
Note: When broadcasting, do not use the external player to broadcast voice, which can cause conflicts with the internal broadcasting of navigation.
public int strategyConvert(boolean avoidCongestion,
boolean avoidHighway,
boolean avoidCost,
boolean prioritiseHighway,
boolean multipleRoute)
注意:该接口仅驾车模式有效
Note: This interface is valid only for driving mode.
avoidCongestion - 是否躲避拥堵avoidHighway - 是否不走高速
whether to avoid expresswaysavoidCost - 是否避免收费prioritiseHighway - 是否高速优先multipleRoute - 单路径or多路径,6.3版本以后该参数已经无效,统一使用多路线算路。public static void destroy()
退出时调用此接口释放导航资源,在调用此接口后不能再调用AMapNavi类里的其它接口。
Exit and call this interface to release navigation resources; after calling this interface, no other interfaces in the AMapNavi class can be called.
public boolean startNavi(int naviType)
naviType - 导航类型,1:实时导航 2:模拟导航。public boolean startNaviWithPath(int naviType,
AMapNaviPathGroup pathGroup)
public void pauseNavi()
public void stopNavi()
public void resumeNavi()
public boolean readNaviInfo()
注意:该接口仅驾车和步行模式有效
Note: This interface is only valid for driving and walking modes.
public boolean readTrafficInfo(int frontDistance)
注意:该接口仅驾车模式有效
Note: This interface is only valid for driving mode.
frontDistance - 要播报的前方路径距离,0为SDK默认距离,-1为整条路径,一般情况下前方路况播报设置为0。public boolean calculateDriveRoute(java.util.List<NaviLatLng> from, java.util.List<NaviLatLng> to, java.util.List<NaviLatLng> wayPoints, int strategy)
from - 指定的导航起点。支持多个起点,起点列表的尾点为实际导航起点,其他坐标点为辅助信息,带有方向性,可有效避免算路到马路的另一侧;to - 指定的导航终点。支持多个终点,终点列表的尾点为实际导航终点,其他坐标点为辅助信息,带有方向性,可有效避免算路到马路的另一侧。wayPoints - 途经点,同时支持最多16个途经点的路径规划;strategy - 规划策略,详情参见 PathPlanningStrategy。普通客车、货车请使用"DRIVING_"开头的策略,驾车推荐使用默认策略 PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT,摩托车请使用"MOTOR_"开头的策略。PathPlanningStrategy. For regular passenger cars and trucks, use strategies starting with "DRIVING_". Driving is recommended to use the default strategy PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT, motorcycles should use strategies starting with "MOTOR_".public boolean calculateDriveRoute(java.util.List<NaviLatLng> to, java.util.List<NaviLatLng> wayPoints, int strategy)
to - 指定的导航终点。支持多个终点,终点列表的尾点为实际导航终点,其他坐标点为辅助信息,带有方向性,可有效避免算路到马路的另一侧。wayPoints - 途经点,同时支持最多16个途经点的路径规划。strategy - 规划策略,详情参见 PathPlanningStrategy。普通客车、货车请使用"DRIVING_"开头的策略,驾车推荐使用默认策略 PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT,摩托车请使用"MOTOR_"开头的策略。PathPlanningStrategy. Regular passenger vehicles and trucks should use strategies starting with "DRIVING_", driving is recommended to use the default strategy PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT, motorcycles should use strategies starting with "MOTOR_".public boolean calculateDriveRoute(java.lang.String fromPoiId,
java.lang.String toPoiId,
java.util.List<java.lang.String> wayPoints,
int strategy)
fromPoiId - 指定的导航起点Poi的Id;toPoiId - 指定的导航终点Poi的Id;wayPoints - 途经点Poi,同时支持最多16个途经点的路径规划;strategy - 规划策略,详情参见 PathPlanningStrategy。普通客车、货车请使用"DRIVING_"开头的策略,驾车推荐使用默认策略 PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT,
摩托车请使用"MOTOR_"开头的策略。PathPlanningStrategy. Use strategies starting with "DRIVING_" for regular passenger vehicles and trucks, driving is recommended to use the default strategy PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT,
Motorcycles should use strategies starting with "MOTOR_".AMapNaviListener算路成功回调。AMapNaviListener.public boolean calculateDriveRoute(java.lang.String toPoiId,
java.util.List<java.lang.String> wayPointIds,
int strategy)
startGPS()开启定位,获取算路的起点startGPS() to enable positioning and obtain the starting point for calculating the route.toPoiId - 指定的导航终点Poi的Id;wayPointIds - 途经点Poi id,同时支持最多16个途经点的路径规划;strategy - 规划策略,详情参见 PathPlanningStrategy。普通客车、货车请使用"DRIVING_"开头的策略,驾车推荐使用默认策略 PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT,摩托车请使用"MOTOR_"开头的策略。PathPlanningStrategy. For regular passenger vehicles and trucks, use strategies starting with "DRIVING_", driving is recommended to use the default strategy PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT,
Motorcycles should use strategies starting with "MOTOR_".AMapNaviListener算路成功回调。AMapNaviListener.public boolean calculateDriveRoute(NaviPoi fromPoi, NaviPoi toPoi, java.util.List<NaviPoi> wayPoints, int strategy)
该方法可以避免到达点问题导致的绕路,地铁等多出口类POI,也会导航到多个出口。
注意:NaviPoi对象中,优先使用Poi id进行算路,失败则使用经纬度进行算路。
This method can avoid detours caused by arrival point issues, and also navigates to multiple exits for multi-exit POIs such as subway stations.
Note: In the NaviPoi object, prioritize using Poi id for routing calculations, and fall back to using latitude and longitude if that fails.
fromPoi - 起点poi NaviPoi,若传入无效起点则使用当前位置NaviPoi, if an invalid starting point is passed, the current position will be usedtoPoi - 终点poi NaviPoiNaviPoiwayPoints - 途经点poi NaviPoiNaviPoistrategy - 规划策略,详情参见 PathPlanningStrategy。普通客车、货车请使用"DRIVING_"开头的策略,驾车推荐使用默认策略 PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT,摩托车请使用"MOTOR_"开头的策略。PathPlanningStrategy. Regular passenger vehicles and trucks should use strategies starting with "DRIVING_". Driving is recommended to use the default strategy PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT. Motorcycles should use strategies starting with "MOTOR_".public boolean calculateDriveRoute(NaviPoi fromPoi, NaviPoi toPoi, java.util.List<NaviPoi> wayPoints, int strategy, AMapCalculateRouteListener listener)
public boolean calculateDriveRoute(NaviPoi fromPoi, NaviPoi toPoi, java.util.List<NaviPoi> wayPoints, AMapNaviCalRouteOptions calRouteOptions)
public void setCarInfo(AMapCarInfo carInfo)
目前小客车算路只考虑车牌因素,货车算路会考虑车高、车重等信息,
其中AMapCarInfo.setRestriction(boolean)}用于控制是否规避限行路段。
AMapCarInfo.setVehicleLoadSwitch(boolean)用于控制算路时是否需要考虑车重。
注意:该接口仅驾车模式有效
Currently, when calculating routes for small cars, only the license plate factor is considered; for trucks, factors like vehicle height and weight are taken into account,
Among which, AMapCarInfo.setRestriction(boolean)} is used to control whether to avoid restricted driving sections.
AMapCarInfo.setVehicleLoadSwitch(boolean) is used to control whether to consider vehicle load during route calculation.
Note: This interface is only valid in driving mode.
carInfo - 车辆信息类public void setTravelInfo(AMapTravelInfo travelInfo)
travelInfo - 车辆信息类public boolean reCalculateRoute(int strategy)
strategy - 指定的驾车策略常量值,参见PathPlanningStrategy;骑步行忽略此参数,传0即可。PathPlanningStrategy;Cycling and walking ignore this parameter, pass 0.public int reCalculateRouteReturnRequestId(int strategy)
public java.util.List<AMapTrafficStatus> getTrafficStatuses(int startPos, int distance)
AMapNaviPath.getTrafficStatuses()AMapNaviPath.getTrafficStatuses()
注意:该接口仅驾车模式有效
Note: This interface is valid only for driving mode
startPos - 参数已无效,传入0即可distance - 参数已无效,传入0即可public AMapNaviPath getNaviPath()
public java.util.HashMap<java.lang.Integer,AMapNaviPath> getNaviPaths()
AMapNaviPath对象AMapNaviPath objectpublic java.util.List<AMapNaviGuide> getNaviGuideList()
AMapNaviPath.getNaviGuideList()AMapNaviPath.getNaviGuideList() insteadpublic NaviSetting getNaviSetting()
public void setEmulatorNaviSpeed(int speed)
驾车默认速度为60km/h,设置的模拟值区间应该在10-120之间.
步行默认速度为20km/h,设置的模拟值区间应该在10-30之间.
骑行默认速度为35km/h,设置的模拟值区间应该在10-50之间.
Default driving speed is 60 km/h, the simulated value range should be between 10-120.
Default walking speed is 20 km/h, the simulated value range should be between 10-30.
Default cycling speed is 35 km/h, the simulated value range should be between 10-50.
speed - 模拟导航的速度,单位:km/h。public void addAMapNaviListener(AMapNaviListener naviListener)
naviListener - 导航回调监听public void removeAMapNaviListener(AMapNaviListener naviListener)
naviListener - 监听listener。public boolean startGPS()
用户可以手动启动卫星定位功能,如果没有启动,在导航启动时(startNavi)会自动启动。默认定位时间间隔为1秒,变化距离为0。
Users can manually activate the satellite positioning function; if not activated, it will automatically start when navigation begins (startNavi). By default, the location update interval is 1 second, and the change distance is 0.
public boolean startGPS(long time,
int dis)
startGPS(long)
Use startGPS(long) instead.
用户可以手动启动手机卫星定位,如果没有启动,在导航启动时(startNavi)会自动启动。
Users can manually activate the satellite positioning function; if not activated, it will automatically start when navigation begins (startNavi).
time - 位置更新的时间间隔, 单位:毫秒。dis - 位置更新的距离间隔, 单位:米。此参数已无效。public boolean startGPS(long interval)
用户可以手动启动手机卫星定位,如果没有启动,在导航启动时(startNavi)内部会自动启动。
Users can manually activate the satellite positioning function; if not activated, it will automatically start internally when navigation starts (startNavi).
interval - 导航内部定位的时间间隔, 单位:毫秒。注意,该参数仅影响导航内部定位塞点的频率,与导航位置回调 AMapNaviListener.onLocationChange(AMapNaviLocation) 的频率无关。AMapNaviListener.onLocationChange(AMapNaviLocation).public boolean stopGPS()
public boolean calculateWalkRoute(NaviLatLng to)
to - 导航终点。调用此接口前需要调用startGPS()开启定位,获取算路的起点。startGPS() to enable positioning and obtain the starting point for routing.public int calculateWalkRouteReturnRequestId(NaviLatLng to)
public boolean calculateWalkRoute(NaviLatLng from, NaviLatLng to)
from - 导航起点。to - 导航终点。public boolean calculateWalkRoute(NaviPoi fromPoi, NaviPoi toPoi, TravelStrategy strategy)
fromPoi - 起点POItoPoi - 终点POIstrategy - 算路策略 TravelStrategyTravelStrategypublic boolean calculateWalkRoute(NaviPoi fromPoi, java.util.List<NaviPoi> wayPoints, NaviPoi toPoi, TravelStrategy strategy)
fromPoi - 起点POI,如果以“我的位置”作为起点,请传null。 如果fromPoi不为null,那么POIID合法,优先使用ID参与算路,否则使用坐标点。wayPoints - 途径点POI,最多支持16个途经点,超过16个会取前16个。如果POIID合法,优先使用ID参与算路。否则使用坐标点。注意:POIID和坐标点不能同时为空。toPoi - 终点POI,如果POIID合法,优先使用ID参与算路,否则使用坐标点。注意:POIID和坐标点不能同时为空。strategy - 路径的计算策略public boolean calculateRideRoute(NaviLatLng to)
to - 骑行终点。调用此接口前需要调用startGPS()开启定位,获取算路的起点。startGPS() to enable positioning and obtain the starting point for route calculation.public boolean calculateRideRoute(NaviLatLng from, NaviLatLng to)
from - 骑行起点。to - 导航终点。public boolean calculateRideRoute(NaviPoi fromPoi, NaviPoi toPoi, TravelStrategy strategy)
fromPoi - 起点POItoPoi - 终点POIstrategy - 算路策略 TravelStrategyTravelStrategy.public boolean calculateRideRoute(NaviPoi fromPoi, java.util.List<NaviPoi> wayPoints, NaviPoi toPoi, TravelStrategy strategy)
fromPoi - 起点POI,如果以“我的位置”作为起点,请传null. 如果fromPoi不为null,那么POIID合法,优先使用ID参与算路,否则使用坐标点wayPoints - 途径点POI,最多支持16个途经点,超过16个会取前16个。如果POIID合法。优先使用ID参与算路。否则使用坐标点。注意:POIID和坐标点不能同时为空toPoi - 终点POI,如果POIID合法,优先使用ID参与算路,否则使用坐标点。注意:POIID和坐标点不能同时为空strategy - 路径的计算策略public boolean calculateEleBikeRoute(NaviLatLng to)
to - 导航终点。public boolean calculateEleBikeRoute(NaviLatLng from, NaviLatLng to)
from - 骑行起点。起点传null,或经纬度为 0 时,使用当前位置作为起点。to - 导航终点。public boolean calculateEleBikeRoute(NaviPoi fromPoi, NaviPoi toPoi, TravelStrategy strategy)
fromPoi - 起点POItoPoi - 终点POIstrategy - 算路策略 TravelStrategyTravelStrategypublic int getEngineType()
EngineTypeEngineTypepublic int getNaviType()
public void startAimlessMode(int aimlessMode)
用户一旦设置,在巡航模式(无路线规划)的状态下,会获得以下回调:
Once set, under cruise mode (no route planning), the following callbacks will be received:
AimlessModeListener.onUpdateTrafficFacility(AMapNaviTrafficFacilityInfo[])可以用于获得道路设施(包括转弯提示等)
AimlessModeListener.onUpdateTrafficFacility(AMapNaviTrafficFacilityInfo[]) can be used to obtain road facilities information including turn prompts etc.
AimlessModeListener.onUpdateAimlessModeElecCameraInfo(AMapNaviTrafficFacilityInfo[])可以用于获得电子眼信息更新
AimlessModeListener.onUpdateAimlessModeElecCameraInfo(AMapNaviTrafficFacilityInfo[]) can be used to update electronic eye information.
AimlessModeListener.updateAimlessModeCongestionInfo(AimLessModeCongestionInfo)可以用于获得周边道路拥堵信息
AimlessModeListener.updateAimlessModeCongestionInfo(AimLessModeCongestionInfo) can be used to obtain surrounding traffic congestion information.
AimlessModeListener.updateAimlessModeStatistics(AimLessModeStat)可以用于巡航模式的统计信息,巡航开启时间,巡航移动距离
AimlessModeListener.updateAimlessModeStatistics(AimLessModeStat) can be used for cruise mode statistics, such as the time when cruise mode was activated and the distance moved during cruise.
AMapNaviListener.onGetNavigationText(int, String)可以用于获得巡航语音播报文字
AMapNaviListener.onGetNavigationText(int, String) can be used to receive voice announcement text during cruise mode.
aimlessMode - 巡航播报模式,详情见AimLessModeAimLessModepublic void stopAimlessMode()
注意:该接口仅驾车模式有效
Note: This interface is valid only in driving mode.
public void setConnectionTimeout(int connectionTimeOut)
connectionTimeOut - 超时时间public void setSoTimeout(int soTimeOut)
soTimeOut - 超时时间public boolean selectRouteId(int id)
注意:该接口仅驾车模式有效
Note: This interface is valid only in driving mode.
id - 路线的routeIdpublic boolean isGpsReady()
public boolean setBroadcastMode(int mode)
注意:该接口仅驾车模式有效
Note: This interface is valid only in driving mode.
mode - 参见BroadcastModeBroadcastModepublic int getBroadcastMode()
public void switchParallelRoad()
switchParallelRoad(int)switchParallelRoad(int)public void switchParallelRoad(int parallelType)
此函数只有在实时导航开始后才能使用,用来将路径的起点切换到当前导航路径平行的其它路径上
This function can only be used after real-time navigation starts, it switches the starting point of the path to another parallel path of the current navigation route
parallelType - 1-主辅路切换,2-高架上下切换public boolean getIsUseExtraGPSData()
public void setIsUseExtraGPSData(boolean isUseExtraData)
只有将此开关打开后,setExtraGPSData(int, Location)方法才会生效。
Only after turning on this switch will the method setExtraGPSData(int, Location) take effect.
isUseExtraData - 是否使用外部定位数据public void setExtraGPSData(int type,
Location location)
使用此方法前需要先调用setIsUseExtraGPSData(boolean)将开关打开.
Before using this method, call setIsUseExtraGPSData(boolean) to enable the feature.
type - 坐标类型。如果使用系统默认返回的定位坐标,type值为1。使用高德坐标,type值传2location - 外部定位数据。Longitude、Latitude、Accuracy、Speed、Bearing、Time 缺一不可public void setNewExtraGPSData(int type,
com.amap.api.location.AMapLocation aMapLocation)
setIsUseExtraGPSData(boolean)将开关打开.type - 坐标类型。如果使用系统默认返回的定位坐标,type值为1。使用高德坐标,type值传2aMapLocation - 外部定位数据。Longitude、Latitude、Accuracy、Speed、Bearing、Time 缺一不可public void setUseInnerVoice(boolean isUseInnerVoice)
AMapNaviListener.onGetNavigationText(int, java.lang.String) 方法将不再回调AMapNaviListener.onGetNavigationText(int, java.lang.String) will no longer be triggered.isUseInnerVoice - 是否使用内部语音播报public void setUseInnerVoice(boolean isUseInnerVoice,
boolean isCallBackText)
isUseInnerVoice - 是否使用内部语音播报, 默认为false isCallBackText - 在将isUseInnerVoice设置为true之后,AMapNaviListener.onGetNavigationText(int, java.lang.String)接口将继续返回文本,默认为false AMapNaviListener.onGetNavigationText(int, java.lang.String) interface will continue to return text, default is falsepublic boolean getIsUseInnerVoice()
public void setSpeechRate(Context context,
float speechRate)
public void setServiceAreaSlopeShowFields(java.lang.String[] showFilds)
中获取public java.lang.String getServiceAreaSlopeShowFields()
public void setSlopeFilter(int minSlopeLength,
int minSlopeAngle,
int slopeType)
minSlopeLength - 指定返回的最小坡长度单位(米),默认2000米.setServiceAreaSlopeType 设置中包含坡度时生效minSlopeAngle - 指定返回的最小坡度,单位(十分之一度),值域:[0,150] 默认2 setServiceAreaSlopeType 设置中包含坡度时生效slopeType - 指定坡度类型 1:上坡(默认值) 2:下坡public int getMinSlopeLength()
public int getMinSlopeAngle()
public int getSlopeType()
public void setMultipleRouteNaviMode(boolean multipleRouteNaviMode)
注意:此方法仅限于在开始导航前调用有效,步行与骑行导航无效,以下情况不会出现多备选路线:模拟导航、货车导航、路线存在途经点、路线长度超过80KM。
Note: This method is only effective before starting navigation, it does not apply to walking or cycling navigation. Multiple alternate routes will not appear under the following conditions: simulated navigation, truck navigation, routes with waypoints, or routes longer than 80KM.
注意:该接口仅驾车模式有效
Note: This interface is only valid for driving mode.
multipleRouteNaviMode - true:多路线导航模式, false:单路线导航模式(默认)public void setTruckMultipleRouteNaviMode(boolean truckMultipleRouteNaviMode)
注意:此方法仅限于在开始导航前调用有效,步行与骑行导航无效,以下情况不会出现多备选路线:模拟导航、路线存在途经点、路线长度超过80KM。
Note: This method is only effective before starting navigation, it does not apply to walking or cycling navigation. Multiple alternate routes will not appear under the following conditions: simulated navigation, routes with waypoints, or routes longer than 80KM.
注意:该接口仅货车导航有效
Note: This interface is only valid for truck navigation.
特别注意:当前接口为收费接口,您如果申请试用或者正式应用都请通过工单系统提交商务合作类工单进行沟通 https://lbs.amap.com/
Special note: This interface is a paid service. If you wish to apply for trial use or formal application, please submit a business cooperation ticket through the order system at https://lbs.amap.com/
truckMultipleRouteNaviMode - true:多路线导航模式, false:单路线导航模式(默认)public void selectMainPathID(long pathId)
注意:该接口仅驾车模式有效
Note: This interface is only valid for driving mode.
pathId - 路线idpublic static java.lang.String getNaviLocation()
public static void setNaviLocation(java.lang.String naviLocation)
naviLocation - public static boolean isNaviStarted()
getNaviType()getNaviType() instead.public void refreshNaviInfo()
public void addParallelRoadListener(ParallelRoadListener listener)
listener - public void removeParallelRoadListener(ParallelRoadListener listener)
listener - public void addAimlessModeListener(AimlessModeListener listener)
listener - public void removeAimlessModeListener(AimlessModeListener listener)
listener - public void addTTSPlayListener(TTSPlayListener listener)
listener - public void removeTTSPlayListener(TTSPlayListener listener)
listener - public void setGpsWeakDetecedInterval(long delayTime)
表示有连续的10s,卫星定位信号质量都比较差,就会触发手机卫星定位信号弱的回调。值越小,就越容易触发,
支持的时间间隔范围为5~15秒
It indicates that if the quality of the satellite positioning signal is poor continuously for 10 seconds, it will trigger a callback for weak mobile satellite signals. The smaller the value, the easier it triggers.
Supported time intervals range from 5 to 15 seconds.
delayTime - 时间间隔,单位为毫秒public void stopSpeak()
注意:7.1.0版本以后,调用该接口,会停止播放导航语音,但是仍然可以播放自定义语音
Note: After version 7.1.0, calling this interface will stop playing navigation voice but still allows custom voice playback
public void startSpeak()
public void setAMapNaviOnlineCarHailingType(AMapNaviOnlineCarHailingType type)
注意:该接口仅驾车模式有效
Note:This interface is only valid for driving mode
type - AMapNaviOnlineCarHailingTypepublic static void setNetWorkingProtocol(NetWorkingProtocol protocol)
注意,该接口仅控制导航业务相关的网络请求,不影响定位、地图sdk内部的请求。
Note: This interface only controls network requests related to navigation services and does not affect positioning or internal map sdk requests.
protocol - 请求协议枚举,详情见 NetWorkingProtocolNetWorkingProtocolpublic boolean playTTS(java.lang.String tts,
boolean forcePlay)
tts - 要播放的文字forcePlay - 是否强制进行播报public java.lang.String getRouteVersion()
public java.lang.String getRouteSdkVersion()
public java.lang.String getPushDataNaviVersion()
public boolean pushDriveRouteWithData(byte[] routeData,
NaviPoi start,
NaviPoi end,
java.util.List<NaviPoi> wayPois,
int strategy)
注意:该接口仅驾车模式有效
Note: This interface is valid only for driving mode.
routeData - 已规划完成的路线数据start - 起点POIInfo,参考NaviPoiNaviPoiend - 终点POIInfo,参考 NaviPoiNaviPoiwayPois - 途经点POIInfo,参考 NaviPoiNaviPoistrategy - 路径的计算策略,供偏航或者刷新时使用AMapCalcRouteResultAMapCalcRouteResultpublic void pushTrajectoryRestoration(Context context,
java.util.List<com.amap.api.maps.model.LatLng> points,
java.util.List<com.amap.api.maps.model.LatLng> wayPoints,
java.lang.String vehicleType,
java.lang.String strategy,
TrajectoryRestorationTaskCallback taskCallback)
context - 对应的Contextpoints - 轨迹点。格式x1,y1|x2,y2。经纬度最多6位小数。wayPoints - 途经点。格式x1,y1|x2,y2。经纬度最多6位小数vehicleType - 车辆类型strategy - 驾车算路策略taskCallback - 任务执行结果回调public boolean pushRouteGuideWithData(JSONObject serverData,
NaviPoi start,
NaviPoi end,
java.util.List<NaviPoi> wayPois,
int strategy)
注意:该接口仅驾车模式有效
Note: This interface is valid only for driving mode.
serverData - 已规划完成的路线数据start - 起点POIInfo,参考NaviPoiNaviPoiend - 终点POIInfo,参考 NaviPoiNaviPoiwayPois - 途经点POIInfo,参考 NaviPoiNaviPoistrategy - 路径的计算策略,供偏航或者刷新时使用AMapCalcRouteResultAMapCalcRouteResultpublic boolean pushRouteGuideWithData(JSONObject serverData,
NaviPoi start,
NaviPoi end,
java.util.List<NaviPoi> wayPois,
int strategy,
AMapCalculateRouteListener listener)
public static java.lang.String getDeviceId(Context context)
context - public static void releaseLocManager()
public static void occupyLocManager()
public boolean independentCalculateRoute(NaviPoi fromPoi, NaviPoi toPoi, java.util.List<NaviPoi> wayPoints, int strategy, int transportType, AMapNaviIndependentRouteListener observer)
fromPoi - 起点信息toPoi - 终点信息wayPoints - 途经点信息,最多支持16个途经点,超过16个会取前16个。如果POIID合法,优先使用ID参与算路,否则使用坐标点。注意:POIID和坐标点不能同时为空strategy - 算路策略: 驾车参考 PathPlanningStrategy, 骑步行参考 TravelStrategyPathPlanningStrategy; for cycling and walking, refer to TravelStrategy.transportType - 交通类型 1-驾车 2-骑行 3-步行observer - 算路结果监听器public boolean independentCalculateRoute(NaviPoi fromPoi, NaviPoi toPoi, java.util.List<NaviPoi> wayPoints, int transportType, AMapNaviIndependentRouteListener observer, AMapNaviCalRouteOptions calRouteOptions)
fromPoi - 起点信息toPoi - 终点信息wayPoints - 途经点信息,最多支持16个途经点,超过16个会取前16个。如果POIID合法,优先使用ID参与算路,否则使用坐标点。注意:POIID和坐标点不能同时为空transportType - 交通类型 1-驾车 2-骑行 3-步行observer - 算路结果监听器calRouteOptions - 算路参数配置,封装invokerType,算路策略,智能排序等参数,用于扩展算路参数.(智能排序只支持驾车,货车)public boolean getRestrictareaInfo(AMapNaviPath path, AMapNaviRestrictAreaInfoListener observer)
path - 路线信息observer - 路线现行信息结果监听器public void setTrafficStatusUpdateEnabled(boolean enable)
需要动态交通信息相关功能时需要调用此接口打开交通信息功能,默认是开启的,
打开后会每1分钟请求一次新的交通信息来更新交通信息。关闭动态交通信息后使用交通信息的相关信息的功能将无法正常使用,包括路况刷新、避免拥堵重算等
When dynamic traffic information-related features are needed, call this interface to activate the traffic information feature, which is enabled by default.
After activation, new traffic information will be requested every minute to update the traffic status. Once the dynamic traffic information function is disabled, related functions such as road condition refresh and recalculation to avoid congestion will no longer work properly.
enable - true-更新路况,false-不更新路况public void setTrafficInfoUpdateEnabled(boolean enable)
默认是开启的,打开此功能后将有整体路况概览与前方路况播报功能,打开此功能后TBT会基本1分钟请求
一次前方路况(此时间间隔不是固定的)。关闭交通台后将没有路况播报功能
By default, it is turned on. After enabling this feature, there will be an overview of overall traffic conditions and announcements of upcoming traffic conditions.
After turning on this feature, TBT will basically request updates on upcoming traffic conditions once per minute (this time interval is not fixed). After disabling the traffic station, there will be no traffic announcement functionality.
enable - true-播报前方路况,false-不播报前方路况public void setCameraInfoUpdateEnabled(boolean enable)
初始电子眼播报是打开的,当电子眼播报打开时,电子眼数据中有限速信息时,同时会播报限速信息
Initially, the electronic eye broadcast is turned on. When the electronic eye broadcast is activated, if there is speed limit information in the electronic eye data, it will also announce the speed limit information
enable - true-播报前方电子眼,false-不播报前方电子眼public static boolean setCustomPosControlEnable(boolean enable)
enable - true-启用 false-禁用public void setCustomPosControlConfig(java.lang.String posConfig)
posConfig - public void setServiceAreaDetailsEnable(boolean enable)
注意: 该功能为高级功能, 如需开通请先联系对应商务开通权限
Note:This is a premium feature. Please contact the corresponding business representative to activate access rights.
enable - public boolean getServiceAreaDetailsEnable()
public void setOnlineCarHailingXML(java.lang.String elementContent)
elementContent - public void setLabelId(java.lang.String labelId)
labelId - public static void setFullLinkLogCallback(FullLinkLogCallback callback)
callback - public static FullLinkLogCallback getFullLinkLogCallback()
public static boolean isDestroyed()
public void setListenToVoiceDuringCall(boolean isListenToVoiceDuringCall)
isListenToVoiceDuringCall - public boolean getListenToVoiceDuringCall()
public void setControlMusicVolumeMode(int controlMusicVolumeMode)
controlMusicVolumeMode - 0:压低音乐; 1:暂停音乐 AMapNaviControlMusicVolumeModeAMapNaviControlMusicVolumeModepublic int getControlMusicVolumeMode()
AMapNaviControlMusicVolumeModeAMapNaviControlMusicVolumeModepublic void configXMLElementAttrib(int calculateType,
java.lang.String elementName,
java.util.Map<java.lang.String,java.lang.String> attributes)
calculateType - 算路方式elementName - 要修改节点的全路径名称 a|b|c
attributes - 节点中添加的Key=Valuepublic void configXMLElementAttrib(int calculateType,
java.lang.String targetElementName,
java.lang.String attributeName,
java.lang.String attributeValue)
calculateType - 算路方式targetElementName - 要修改节点的全路径名称 a|b|c attributeName - 添加属性KeyattributeValue - 添加属性Valuepublic void insertXMLElement(int calculateType,
java.lang.String targetElementName,
java.util.Map<java.lang.String,java.lang.String> subElementMap)
calculateType - 算路方式targetElementName - 要修改节点的全路径名称 a|b|c subElementMap - 节点数组public void insertXMLElement(int calculateType,
java.lang.String targetElementName,
java.lang.String subElementName,
java.lang.String subElementValue)
calculateType - 算路方式targetElementName - 要修改节点的全路径名称 a|b|c subElementName - 节点名称subElementValue - 节点值public boolean delateCustomXMLElementAttrib(int calculateType,
java.lang.String targetElementName,
java.lang.String attributeName)
calculateType - 算路方式targetElementName - 要修改节点的全路径名称 a|b|c attributeName - 添加属性Keypublic boolean delateCustomXMLElement(int calculateType,
java.lang.String targetElementName,
java.lang.String subElementName)
calculateType - 算路方式targetElementName - 要修改节点的全路径名称 a|b|c subElementName - 节点名称public void setShareBizScene(boolean isShareBizScene)
isShareBizScene - true 表示共享业务,默认为falsepublic void setSCTXPassangerAdiu(java.lang.String passangerAdiu)
passangerAdiu - adiupublic void setCPProduct(java.lang.String cpProduct)
cpProduct - public void setCPOrderId(java.lang.String cpOrderId)
cpOrderId - public void setTrafficSignalEnable(boolean enable)
enable - true-启用 false-禁用public void setNaviNetworkProxy(AMapNaviNetWorkProxy proxy)
public void setIsNaviTravelView(boolean isTravel)
public boolean getIsNaviTravelView()
public void setInnerOptRecordEnable(java.lang.String key)
key - public void setIsOpenTrafficLight(java.lang.String key)
key - public static void setAppLang(Context context,
AMapNaviAppLangOptions aMapNaviAppLangOptions,
AudioAuthTaskCallback audioAuthTaskCallback)
context - 上下文aMapNaviAppLangOptions - 语言选项配置public static int getAppLang()
public void setNaviResourceProxy(AMapNaviResourceProxy proxy)
public AMapNaviResourceProxy getNaviResourceProxy()
public void setHazardousChemicals(boolean isHazardousChemicals)
isHazardousChemicals - 是否开启危化品车辆导航public void setNaviParkEnabled(boolean isEnabled)
注意:
Notes:
该功能为高级功能,如需开通请先联系对应商务开通对应权限。
This is a premium feature. Please contact the corresponding business representative to activate access rights
isEnabled - 是否开启, true: 开启; false:关闭。默认值:falseisEnabled - "Whether to enable. true: enabled; false: disabled. Default value: false."public boolean isNaviParkEnabled()
public void setCustomNaviParkLimitInfo(AMapNaviParkLimitInfo limitInfo)
AMapNaviParkLimitInfoAMapNaviParkLimitInfo
当通过setNaviParkEnabled(boolean)开启园区导航, 并且通过setIsInsidePrivatePark(boolean)设置为true时,限制信息才会生效
when passing through setNaviParkEnabled(boolean) Open the park navigation and use setIsInsidePrivatePark(boolean) "When set to true, the restriction information will take effect."
limitInfo - 自定义限制信息AMapNaviParkLimitInfo,
setNaviParkEnabled(boolean),
setIsInsidePrivatePark(boolean)public void setIsInsidePrivatePark(boolean isInside)
isInside - 是否在园区内, true: 是, false: 否public boolean setAvoidAreas(AMapCarInfo carInfo, java.util.List<java.util.List<NaviLatLng>> avoidAreas)
注意事项:
Notes:
carInfo - 车辆信息avoidAreas - 避让区域信息, 最多支持100个区域,每个区域支持的顶点范围[3-16],设置为null或空,则代表没有避让区域public void clearAvoidAreas(AMapCarInfo carInfo)
carInfo - 车辆信息public void setAllowReCalcRouteWhenMpidRestoreFail(boolean allow)
allow - 当mpid还原路线失败之后,是否允许使用传入的起终点重新算路, true: 允许; false: 不允许, 默认值:truepublic void setMpid(java.lang.String mpid)
clearMpid()移除mpid,否则会影响后续算路的结果。mpid - 定制路线的标识setMpidRestoreOption(AMapNaviMpidRestoreOption)setMpidRestoreOption(AMapNaviMpidRestoreOption)public void setMpidRestoreOption(AMapNaviMpidRestoreOption option)
clearMpidRestoreOption()移除mpid,否则会影响后续算路的结果。clearMpidRestoreOption() Remove the mpid, otherwise it will affect the subsequent route calculation results.
封装mpid相关参数mpid、mpid_restore_typepublic void clearMpid()
注意:需要在停止导航或者到达终点时,主动清空mpid,否则会影响下次的路线规划结果
Note:"The mpid must be cleared when navigation is stopped or the destination is reached; otherwise, it may affect the next route planning results."
clearMpidRestoreOption()clearMpidRestoreOption()public void clearMpidRestoreOption()
注意:需要在停止导航或者到达终点时,主动清空mpid,否则会影响下次的路线规划结果
Note:"The mpid must be cleared when navigation is stopped or the destination is reached; otherwise, it may affect the next route planning results."
public void setIgnoreRestriction(boolean isIgnore)
isIgnore - 是否忽略限行,true:忽略;false: 不忽略,默认值:false public void setOrderStatus(int orderStatus)
orderStatus - 订单状态 public boolean calculateDriveRouteWithMultiStart(java.util.List<NaviLatLng> from, NaviPoi to, java.util.List<NaviPoi> wayPoints, int strategy)
from - 指定的导航起点。支持多个起点,起点列表的尾点为实际导航起点,其他坐标点为辅助信息,带有方向性,可有效避免算路到马路的另一侧; to - 终点POI。 wayPoints - 途经点Poi,最多支持16个途经点的路径规划; strategy - 规划策略,详情参见 PathPlanningStrategy。 PathPlanningStrategy。
普通客车、货车请使用"DRIVING_"开头的策略,驾车推荐使用默认策略 PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT, public boolean calculateDriveRouteWithMultiEnd(NaviPoi from, java.util.List<NaviLatLng> to, java.util.List<NaviPoi> wayPoints, int strategy)
from - 起点poi,若传入无效起点则使用当前位置,优先使用Poi id进行算路,失败则使用经纬度进行算路。 to - 指定的导航终点。支持多个终点,终点列表的尾点为实际导航终点,其他坐标点为辅助信息,带有方向性,可有效避免算路到马路的另一侧。 wayPoints - 途经点,同时支持最多16个途经点的路径规划; strategy - 规划策略,详情参见 PathPlanningStrategy。 PathPlanningStrategy。
普通客车、货车请使用"DRIVING_"开头的策略,驾车推荐使用默认策略 PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT, public boolean calculateDriveRouteWithMultiPoints(java.util.List<NaviLatLng> from, java.util.List<NaviLatLng> to, java.util.List<NaviPoi> wayPoints, int strategy)
from - 指定的导航起点。支持多个起点,起点列表的尾点为实际导航起点,其他坐标点为辅助信息,带有方向性,可有效避免算路到马路的另一侧; to - 指定的导航终点。支持多个终点,终点列表的尾点为实际导航终点,其他坐标点为辅助信息,带有方向性,可有效避免算路到马路的另一侧。 wayPoints - 途经点Poi列表,同时支持最多16个途经点的路径规划; strategy - 规划策略,详情参见 PathPlanningStrategy。 PathPlanningStrategy。
普通客车、货车请使用"DRIVING_"开头的策略,驾车推荐使用默认策略 PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT, public void setAMapRouteOptimalParams(AMapRouteOptimalParams optimalParams)
optimalParams - public boolean calculateOptimalRouteOnNavigating()
public boolean navigationWithOptimalRoute()
public AMapCarInfo getCarInfo()
public AMapTravelInfo getTravelInfo()
public void getMpidWithNaviRoutes(java.util.List<AMapNaviPath> routes, AMapNaviMpidOption option, GenerateMpidCallback observer)
routes - 导航路线列表 option - 自定义选项,可以为 null observer - 回调函数,接收错误和 mpid 列表 public static void addTTSInitializeListener(TTSInitializeListener ttsInitializeListener)
注意事项:
Notes:
ttsInitializeListener - 监听对象 public static TTSInitializeListener getTTSInitializeListener()
public static AudioOutputMode getAudioOutputMode()
public static void setAudioOutputMode(AudioOutputMode audioMode)
public static void setTTSOption(AMapTtsOption ttsOption)
ttsOption - TTS配置对象public static AMapTtsOption getTTSOption()