我正在尝试在Mapbox导航中测试路线检测,但无法正常工作。我已跟踪并调用了OffRouteDetector.isUserOffRouteWith ,但是status.getRouteState()仅返回“ INITIALIZED”(这不是预期的RouteState.OFFROUTE)
我怀疑我正在旅行时遇到一个极端情况,因为起点和终点距离我的当前位置很远。因此,它永远不会“走下去”。但是,这 在我的应用程序中是一个有效的方案(它涉及到存储的路由,由于公共安全方面的考虑,它们是不变的)。
我在github上发布了一个问题(已关闭),但是对于背景来说,它是here
编辑: 这是一些代码,可以更接近我正在尝试做的事情。这是来自默认android studio项目的MainActivity的onCreate:
String jsonRoute = "{\"routes\":[{\"legs\":[{\"steps\":[{\"intersections\":[{\"out\":1,\"entry\":[false,true],\"bearings\":[0,90],\"location\":[-71.45082724993496,43.070903929852619],\"in\":0},{\"out\":1,\"entry\":[false,true],\"bearings\":[27,90],\"location\":[-71.444301000091471,43.023085298378462],\"in\":0}],\"driving_side\":\"right\",\"weight\":7560.0,\"geometry\":\"mbxcqArekhgCoG{B}HmGuHaLaGiT{@mPHs[bJggEUqYiA_KgCcJyKyVyGgJ\",\"maneuver\":{\"bearing_after\":90,\"type\":\"depart\",\"modifier\":\"\",\"bearing_before\":0,\"location\":[-71.45082724993496,43.070903929852619],\"instruction\":\"Travel on NO NAME\"},\"duration\":0.0,\"distance\":547.06000000000006,\"name\":\"NO NAME\",\"mode\":\"driving\",\"voiceInstructions\":[{\"distanceAlongGeometry\":547.06000000000006,\"announcement\":\"Travel on NO NAME, then Turn right onto US-3 [NH-28], [HOOKSETT RD]\",\"ssmlAnnouncement\":\"<speak><amazon:effect name=\\\"drc\\\"><prosody rate=\\\"1.08\\\">Travel on NO NAME, then Turn right onto US-3 [NH-28], [HOOKSETT RD]</prosody></amazon:effect></speak>\"},{\"distanceAlongGeometry\":90.0,\"announcement\":\"Turn right onto US-3 [NH-28], [HOOKSETT RD]\",\"ssmlAnnouncement\":\"<speak><amazon:effect name=\\\"drc\\\"><prosody rate=\\\"1.08\\\">Turn right onto US-3 [NH-28], [HOOKSETT RD]</prosody></amazon:effect></speak>\"}],\"bannerInstructions\":[{\"distanceAlongGeometry\":547.06000000000006,\"primary\":{\"text\":\"US-3 / NH-28 / HOOKSETT RD\",\"type\":\"turn\",\"modifier\":\"right\",\"degrees\":0,\"components\":[{\"type\":\"text\",\"text\":\"US-3\",\"delimiter\":false},{\"type\":\"delimiter\",\"text\":\"/\",\"delimiter\":true},{\"type\":\"text\",\"text\":\"NH-28\",\"delimiter\":false},{\"type\":\"delimiter\",\"text\":\"/\",\"delimiter\":true},{\"type\":\"text\",\"text\":\"HOOKSETT RD\",\"delimiter\":false}]},\"secondary\":null}]},{\"intersections\":[{\"out\":1,\"entry\":[false,true],\"bearings\":[27,90],\"location\":[-71.444301000091471,43.023085298378462],\"in\":0},{\"out\":1,\"entry\":[false,true],\"bearings\":[197,211],\"location\":[-71.444535949177578,43.0230007289918],\"in\":0}],\"driving_side\":\"right\",\"weight\":6677.0,\"geometry\":\"}yycqAzk_hgCpLqOrNaNhTqMlfAsm@|\\\\eSb`@{ZvoBinBrKkJ~t@cg@r\\\\wQvrHimDv}Asz@xz@gd@n\\\\}PrpAil@prCmvAhgBa_A|m@qZvPcJlx@{]l_@iN~GuC~VgFpO}@bGEd[zBvo@jJ|cAeHvoCsWn]eJzuAkf@p`@aQ|sBypAzSkKrMsExPmDlUgAzNx@~OrC|NjFvaBp|@h]dMtmAbZb`Bv`@h\\\\fOxpCvtB|SjSrKxNjO`\\\\~FtNzKp_@xI|NrI`JvlHdmG\",\"maneuver\":{\"bearing_after\":90,\"type\":\"turn\",\"modifier\":\"right\",\"bearing_before\":27,\"location\":[-71.444301000091471,43.023085298378462],\"instruction\":\"Turn right onto US-3 [NH-28], [HOOKSETT RD]\"},\"duration\":186.0,\"distance\":5921.12,\"name\":\"US-3\",\"mode\":\"driving\",\"voiceInstructions\":[{\"distanceAlongGeometry\":5792.4000000000005,\"announcement\":\"In 3.6miles, I-93 SB ON RAMP\",\"ssmlAnnouncement\":\"<speak><amazon:effect name=\\\"drc\\\"><prosody rate=\\\"1.08\\\">In 3.6miles, I-93 SB ON RAMP</prosody></amazon:effect></speak>\"},{\"distanceAlongGeometry\":90.0,\"announcement\":\"I-93 SB ON RAMP\",\"ssmlAnnouncement\":\"<speak><amazon:effect name=\\\"drc\\\"><prosody rate=\\\"1.08\\\">I-93 SB ON RAMP</prosody></amazon:effect></speak>\"}],\"bannerInstructions\":[{\"distanceAlongGeometry\":5921.12,\"primary\":{\"text\":\"I-93 NB EXIT 9 OFF RAMP\",\"type\":\"turn\",\"modifier\":\"straight\",\"degrees\":0,\"components\":[{\"type\":\"text\",\"text\":\"I-93 NB EXIT 9 OFF RAMP\",\"delimiter\":false}]},\"secondary\":null}]},{\"intersections\":[{\"out\":1,\"entry\":[false,true],\"bearings\":[197,211],\"location\":[-71.444535949177578,43.0230007289918],\"in\":0},{\"out\":1,\"entry\":[false,true],\"bearings\":[126,135],\"location\":[-71.2864750743811,42.81703500887609],\"in\":0}],\"driving_side\":\"right\",\"weight\":838.0,\"geometry\":\"im|`qA~srggCfe@`l@lGlLtDpZ]~LoDpReEfJoHbIw`Ajt@mPlEiIQyNcGuFkG_HmUq@}QV{EfB_MfAqDpIaOxtAetA\",\"maneuver\":{\"bearing_after\":211,\"type\":\"turn\",\"modifier\":\"straight\",\"bearing_before\":197,\"location\":[-71.444535949177578,43.0230007289918],\"instruction\":\"I-93 SB ON RAMP\"},\"duration\":23.0,\"distance\":788.41,\"name\":\"I-93 NB EXIT 9 OFF RAMP\",\"mode\":\"driving\",\"voiceInstructions\":[{\"distanceAlongGeometry\":643.6,\"announcement\":\"In 0.4miles, Continue straight on I-93 SOUTH\",\"ssmlAnnouncement\":\"<speak><amazon:effect name=\\\"drc\\\"><prosody rate=\\\"1.08\\\">In 0.4miles, Continue straight on I-93 SOUTH</prosody></amazon:effect></speak>\"},{\"distanceAlongGeometry\":90.0,\"announcement\":\"Continue straight on I-93 SOUTH\",\"ssmlAnnouncement\":\"<speak><amazon:effect name=\\\"drc\\\"><prosody rate=\\\"1.08\\\">Continue straight on I-93 SOUTH</prosody></amazon:effect></speak>\"}],\"bannerInstructions\":[{\"distanceAlongGeometry\":788.41,\"primary\":{\"text\":\"I-93 SOUTH\",\"type\":\"turn\",\"modifier\":\"straight\",\"degrees\":0,\"components\":[{\"type\":\"text\",\"text\":\"I-93 SOUTH\",\"delimiter\":false}]},\"secondary\":null}]},{\"intersections\":[{\"out\":1,\"entry\":[false,true],\"bearings\":[126,135],\"location\":[-71.2864750743811,42.81703500887609],\"in\":0},{\"out\":1,\"entry\":[false,true],\"bearings\":[136,140],\"location\":[-71.275545391600389,42.809408142172572],\"in\":0}],\"driving_side\":\"right\",\"weight\":27322.0,\"geometry\":\"_h|`qAtbsggCbE}C~FgGbxK_zIloDguC|i@w`@j\\\\mSn\\\\}Pf]aOf`AmYx`@aIjdGmz@nrCqb@rb@}Irs@uSzo@s^x]{ZvZ}_@hO}TzV}f@lMy\\\\tJsZfu@auCxdA}gE`W_z@b_@}zApO_h@pHsRnIoQ`JiQbJ{NpXq]`[sXn\\\\cT`_@eO|c@mMxp@kN|]gIpiAyVho@oLjcBeR`wBmIb{DiQpq@cFl~BuZvmDcf@|a@eF|u@sGdQk@xPgAvc@w@|uDaHz}CsIv{@}Gvr@kR`k@sWvpB{eAjfAij@`o@cZf}@}XvkB{_@ft@_Qtp@qYbXoRzZiZbXm^x`Ak{A`^mk@na@_k@|m@k~@zDsEvF}HzYm[~KqLlLsKrPoLlzAajAx]yZz\\\\c_@xN}Q~MyS~s@{hAzd@ov@hrKetP~n@caA`NyS|J_M|\\\\gb@l\\\\{\\\\n^k[z_@gYfr@ua@bo@sWr_@_Od|Aif@lrAoc@~cCsw@blA}`@riBql@tk@}T`_A_e@pyDgaCvpUauNhlAyp@b}B{fAv`@}TlwH}zCzjK}dEphAki@dj@{[viAuu@l}@ut@xgAifAfpIg~JjcFwbGhSgTh_@s\\\\r]yVfb@wVld@yRxWsJlM{D`tW}kHhvBwo@nl@qXnr@cc@|pAqhAto@g{@tj@k_AlWyi@lUeh@~^sgAr\\\\usAl`@abC~]qxBvU_wAvYoyAnJqb@fT}v@j]ghAd]q{@xSqe@ls@{tAlWoc@dTy[hv@qeAd]o`@nm@{l@r}UouSt}@u{@~z@w_AdcDkfEtmBkfCvZy_@p^sa@l^u]d_@y[haAup@vp@q\\\\|cAgf@|wA_n@xi@w\\\\xm@sYtlHcgDdnAek@nvAko@v~@ic@lx@of@\",\"maneuver\":{\"bearing_after\":135,\"type\":\"turn\",\"modifier\":\"straight\",\"bearing_before\":126,\"location\":[-71.2864750743811,42.81703500887609],\"instruction\":\"Continue straight on I-93 SOUTH\"},\"duration\":803.0,\"distance\":27320.82,\"name\":\"I-93 SOUTH\",\"mode\":\"driving\",\"voiceInstructions\":[{\"distanceAlongGeometry\":25744.0,\"announcement\":\"In 16miles, I-93 SB EXIT 3 OFF RAMP TO NH-111\",\"ssmlAnnouncement\":\"<speak><amazon:effect name=\\\"drc\\\"><prosody rate=\\\"1.08\\\">In 16miles, I-93 SB EXIT 3 OFF RAMP TO NH-111</prosody></amazon:effect></speak>\"},{\"distanceAlongGeometry\":90.0,\"announcement\":\"I-93 SB EXIT 3 OFF RAMP TO NH-111\",\"ssmlAnnouncement\":\"<speak><amazon:effect name=\\\"drc\\\"><prosody rate=\\\"1.08\\\">I-93 SB EXIT 3 OFF RAMP TO NH-111</prosody></amazon:effect></speak>\"}],\"bannerInstructions\":[]},{\"intersections\":[{\"out\":1,\"entry\":[false,true],\"bearings\":[136,140],\"location\":[-71.275545391600389,42.809408142172572],\"in\":0},{\"out\":1,\"entry\":[false,true],\"bearings\":[90,0],\"location\":[-71.408027396106363,42.771592398141067],\"in\":0}],\"driving_side\":\"right\",\"weight\":1481.0,\"geometry\":\"c_jtpAzk~}fC`o@c]br@}o@~f@eo@n\\\\uh@`e@{_AdZyw@dW_}@lnAcnEz^yrAnBaHhM_\\\\lJgPfKmN|O{KbIgCzQ_D`FpAxC|CjBjKpCn`@\",\"maneuver\":{\"bearing_after\":140,\"type\":\"turn\",\"modifier\":\"straight\",\"bearing_before\":136,\"location\":[-71.275545391600389,42.809408142172572],\"instruction\":\"I-93 SB EXIT 3 OFF RAMP TO NH-111\"},\"duration\":41.0,\"distance\":1383.74,\"name\":\"I-93 I93 S OFF RAMP\",\"mode\":\"driving\",\"voiceInstructions\":[{\"distanceAlongGeometry\":1287.2,\"announcement\":\"In 0.8miles, Merge onto NH-111 [INDIAN ROCK RD]\",\"ssmlAnnouncement\":\"<speak><amazon:effect name=\\\"drc\\\"><prosody rate=\\\"1.08\\\">In 0.8miles, Merge onto NH-111 [INDIAN ROCK RD]</prosody></amazon:effect></speak>\"},{\"distanceAlongGeometry\":90.0,\"announcement\":\"Merge onto NH-111 [INDIAN ROCK RD]\",\"ssmlAnnouncement\":\"<speak><amazon:effect name=\\\"drc\\\"><prosody rate=\\\"1.08\\\">Merge onto NH-111 [INDIAN ROCK RD]</prosody></amazon:effect></speak>\"}],\"bannerInstructions\":[{\"distanceAlongGeometry\":1383.74,\"primary\":{\"text\":\"NH-111 / INDIAN ROCK RD\",\"type\":\"turn\",\"modifier\":\"straight\",\"degrees\":0,\"components\":[{\"type\":\"text\",\"text\":\"NH-111\",\"delimiter\":false},{\"type\":\"delimiter\",\"text\":\"/\",\"delimiter\":true},{\"type\":\"text\",\"text\":\"INDIAN ROCK RD\",\"delimiter\":false}]},\"secondary\":null}]},{\"intersections\":[{\"out\":1,\"entry\":[false,true],\"bearings\":[90,0],\"location\":[-71.408027396106363,42.771592398141067],\"in\":0}],\"driving_side\":\"right\",\"weight\":20698.0,\"geometry\":\"mb{spAx`i}fCLhi@~CvvAzj@laHlN|u@dyAnwFpIh\\\\tLvo@jM`gAjJ~|Afb@`gHhDfn@rDz`@rH`g@zObt@~Vns@~`@pu@lv@pdAxbBjuBxUj^vIfUtOhc@zSzw@vC`SnIt}@v@lfAuBbj@gDb`@urAlhNcWtlB}dA`rGiuBjjM_UxxA_OtcBuCfl@iB|bACxu@pCdpAl_AfnMzNjoBzIxu@hJfm@`UncApT~p@dc@fbAph@n{@ds@nfAhuBphDhtAnuBthC`eEr{AnnCfkAvwBdwBvvDz[bf@pqA~bBdwB|rCpe@~o@vg@py@f_@zx@h~G~vPhTti@ba@xoAvMnj@ppAbgG~\\\\p|At]zxAt]`pA`f@n}Ap\\\\p`ArdBduEro@|dB`cChrG\",\"maneuver\":{\"bearing_after\":0,\"type\":\"arrive\",\"modifier\":\"\",\"bearing_before\":90,\"location\":[-71.408027396106363,42.771592398141067],\"instruction\":\"Merge onto NH-111 [INDIAN ROCK RD]\"},\"duration\":503.0,\"distance\":12421.48,\"name\":\"NH-111\",\"mode\":\"driving\",\"voiceInstructions\":[{\"distanceAlongGeometry\":12389.300000000001,\"announcement\":\"In 7.7miles, Arrive at destination.\",\"ssmlAnnouncement\":\"<speak><amazon:effect name=\\\"drc\\\"><prosody rate=\\\"1.08\\\">In 7.7miles, Arrive at destination.</prosody></amazon:effect></speak>\"},{\"distanceAlongGeometry\":90.0,\"announcement\":\"Arrive at destination.\",\"ssmlAnnouncement\":\"<speak><amazon:effect name=\\\"drc\\\"><prosody rate=\\\"1.08\\\">Arrive at destination.</prosody></amazon:effect></speak>\"}],\"bannerInstructions\":[{\"distanceAlongGeometry\":12421.48,\"primary\":{\"text\":\"NH-111 / CENTRAL ST\",\"type\":\"arrive\",\"modifier\":\"\",\"degrees\":0,\"components\":[{\"type\":\"text\",\"text\":\"NH-111\",\"delimiter\":false},{\"type\":\"delimiter\",\"text\":\"/\",\"delimiter\":true},{\"type\":\"text\",\"text\":\"CENTRAL ST\",\"delimiter\":false}]},\"secondary\":null}]}],\"summary\":\"NO NAME, 1.4mi S of Hooksett - NH-111, 3.1mi NE of Nashua\",\"duration\":1556.0,\"distance\":48366.5390625,\"weight\":66578.0}],\"geometry\":\"mbxcqArekhgCoG{BcOoNyEyKwDgTQif@bJggEUqYiA_KcI{UwNiVdUkX~EgEv{Ae|@`w@yh@`aAu~@tt@{t@rKkJ~t@cg@vr@m^b|BceAze@uTzV{KlhDydB|`Aei@nVyLnuAyp@huHowDhWcN~VqLzt@mZxZeKdP}CtWcAd[zBta@lHvU|@~kEy`@ni@mO|bBin@vPaJ|_Awl@tQcL`WwOzSkKrMsExPmDbPw@hDOzNx@rWjFj_@dQlq@v_@bh@vVb{Ax_@b`Bv`@h\\\\fOzaCbhBr[rXzRdVpIjPxRnh@zElQlOvUxgH`iG|HjGhk@xs@rC`KlBdTkAlT}EfQ{FtIueA|x@mPlEcToCuKqK{EiNwBuRXgLfB_MtDmJfKoNjyAiwAjn@wh@j|JyaIf`DmhC|i@w`@j\\\\mSn\\\\}Pf]aOd_@yLhOyEvOyDx`@aIr\\\\wErlKq|AzdAiYzo@s^x]{ZhLaNvf@it@nV_k@tXs|@zsA}kF~]i{A`W_z@vWofAnNmh@lG_SpHsRnIoQ`JiQdWs_@nKyL`[sXfMwIfNkIbOoG|NuF|c@mMzx@_Q`iA_Wp}@sQnlBoTlZe@nxHk_@ffAiK~hAuPvmDcf@zs@eI~c@sD~b@sBvrHqMtXeCzhBsJvr@kRlcG}{CxO_Hr^_Mr]}Jt_@kIbpBoa@~^_Ln_@mQtK}Gth@_f@|o@_`A`hAgfBrvAorBhn@mq@lLsKt|@_q@jn@qe@hv@ct@~J}LrnHgiLvuE}kH`~@}uAzh@gp@l\\\\{\\\\n^k[z_@gYfr@ua@bo@sWr_@_OroDyjAv{HcgCtk@}T`_A_e@|hOcjJl_D{nBd_CswA~a@oXlWwNhe@mZtn@e^flAsm@vb@mSnkAkl@dhMccFh`HyqCxz@cd@zdAcq@`uAifAv}Ae~AthOirQhi@al@h_@s\\\\r]yVfb@wVld@yRxWsJriRskFx_AaWtdDu~@thAe^nl@qX`i@g\\\\|a@yZlw@ss@vWe\\\\zr@}eAd_@ws@pl@exAfj@cpBd[uiBl[qqBx`@caCnH}`@rTaeAxTa}@rY{`Ap\\\\g~@zUkj@lPg]zj@mfAlWoc@fl@s{@`m@qv@z|@q}@feP_oNluA_nA|`BovAt}@u{@~z@w_Axc@{j@j~BozCd}A}rBnOmRtE{Frs@qz@ln@uk@dOyMhaAup@tuBycA|wA_n@xi@w\\\\xmBg|@~dNcqGrWoO|MgJ`o@c]br@}o@zu@ecAn^}o@db@c`AlZ}~@jxAoiFjb@{{AdCsHbIkRrDgG`QmWhKyHvRmHzL{A`FpAxC|CjBjKpCn`@Lhi@~CvvA`b@foFxGdq@lN|u@lv@`xCrZjjAtPjp@nE`VjPpfApNdwBfb@`gH|IbpA~CzWlMdo@`FbSzM`a@bHlQpSna@~]dj@nhAtxAd_AbjAxUj^lDvI~Txn@zSzw@`H|f@xFfbAPx_@cChx@kTjbCqbAdfKqg@zoDyV`|Aab@tgCox@p`Fsp@xzDyZ|pBeGnl@oKlcBuBzyAhAbpA`F~eAzz@dgLzNjoBzIxu@hJfm@`UncApT~p@dc@fbAjsG|eKhlCdgEp[xj@~iCjyEziCxsEz[bf@||@~iAjeDhlEfTpZn_@rn@f_@zx@jmH`uQlM|\\\\|Xn~@zW~iAj`@`lBjXppA|z@bzDbk@jvBhs@v{B|tBnxFzmA~eDbOr`@ds@djBlPvb@fz@~~Bgi@e|A\",\"duration\":1556.0,\"distance\":48366.54,\"weight\":66578.0,\"weight_name\":\"routability\",\"voiceLocale\":\"en-US\"}],\"waypoints\":[{\"name\":\"NO NAME, 1.4mi S of Hooksett\",\"location\":[-71.45688,43.07003]},{\"name\":\"NH-111, 3.1mi NE of Nashua\",\"location\":[-71.40803,42.77159]}],\"code\":\"Ok\",\"uuid\":\"cjqsavmw70crz3po391gqh3mp\"}";
DirectionsResponse directions = DirectionsResponse.fromJson(jsonRoute);
DirectionsRoute route = directions.routes().get(0);
ArrayList<Point> wpPoints = new ArrayList<Point>();
for(DirectionsWaypoint w : directions.waypoints())
wpPoints.add((w.location()));
RouteOptions newRO = RouteOptions.builder()
.profile(DirectionsCriteria.PROFILE_DRIVING)
.coordinates(wpPoints)
.user("mapbox")
.geometries(DirectionsCriteria.GEOMETRY_POLYLINE6)
.accessToken(accessToken)
.requestUuid(directions.uuid())
.baseUrl("https://api.mapbox.com")
.waypointNames("")
.continueStraight(true)
.annotations("distance")
.approaches("")
.bearings(";")
.alternatives(false)
.language("en")
.radiuses("")
.voiceInstructions(true)
.bannerInstructions(true)
.roundaboutExits(true)
.overview("full")
.steps(true)
.voiceUnits("imperial")
.exclude("")
.waypointTargets("")
.build();
route = route.toBuilder().routeOptions(newRO).build();
boolean simulateRoute = false;
// Create a NavigationLauncherOptions object to package everything together
NavigationLauncherOptions options = NavigationLauncherOptions.builder()
.directionsRoute(route)
.shouldSimulateRoute(simulateRoute)
.build();
// Call this method with Context from within an Activity
NavigationLauncher.startNavigation(this, options);
答案 0 :(得分:1)
@Troy Berg让我花点时间解释一下加载新路由时,路由遵循代码在内部如何工作。
在加载新路由时,如果路由json有效,则MapboxNavigator
将以INITIALIZED
状态开始。从那里,它将尝试获得信心,即传入的GPS位置实际上就是用户所在的位置。为了建立这种信任,它需要至少接收一些位置更新,并且这些更新必须在时间和空间上保持一致。在建立信任关系的过程中,它将报告INITIALIZED
状态。
一旦建立了用户对当前位置更新流的信任,MapboxNavigator
将尝试测量用户沿当前加载的路线的进度。如果发现用户的位置与路线本身不合理地相距太远,则将状态翻转为OFFROUTE
状态。
如果用户的当前位置与当前加载的路线相距合理距离,但距离当前距离尚不足以被视为正在路上(TRACKING
),我们将继续返回INITIALIZED
状态并等待用户前往路线。我们称其为畜栏。系泊使用户(例如,在他/她的车道或商店的停车场中)加载一条路线,而不会立即被标记为OFFROUTE
。进行锁定时,如果用户不断远离路线前进,他们最终将被标记为OFFROUTE
。
答案 1 :(得分:0)
我继续,仅设置了自己的offRouteEngine。不过,我保留了原件,并在我的原件中加以引用。代码是:
MapboxNavigation mbn = navigationView.retrieveMapboxNavigation();
orEngine = (OffRouteDetector)mbn.getOffRouteEngine();
mbn.setOffRouteEngine(new OffRouteDetector() {
@Override
public boolean isUserOffRoute(Location location, RouteProgress routeProgress, MapboxNavigationOptions options) {
Boolean isOffRoute = orEngine.isUserOffRoute(location, routeProgress, options);
// User will never be off-route
return isOffRoute;
}
public boolean isUserOffRouteWith(NavigationStatus status) {
return orEngine.isUserOffRouteWith(status) || status.getRouteState() == RouteState.INITIALIZED;
}
});
在该代码中,我将“ INITIALIZED”状态计为偏离路线。因为我不重新路由而是显示一条消息,所以我认为应该可以。
如果您发现此方法有任何问题,请告诉我,谢谢您的帮助!