【问题标题】:HERE Android SDK Turn by turn instructionHERE Android SDK 轮流指令
【发布时间】:2016-04-27 16:18:51
【问题描述】:

我正在使用 HERE Android SDK 来执行转弯导航项目。但我没有得到类似于图像的结果。

我有这个代码来获取当前的 manauver

private NavigationManager.NewInstructionEventListener newInstructionEventListener = new NavigationManager.NewInstructionEventListener() {
    @Override
    public void onNewInstructionEvent() {
        Maneuver maneuver = navigationManager.getNextManeuver();

        if (maneuver != null) {
            if (maneuver.getAction() == Maneuver.Action.END) {

            }

            tvManeuver.setText(navigationManager.getNextManeuver().getTurn().name() + " " + maneuver.getIcon().value());
            ivTitle.setImageBitmap(maneuver.getNextRoadImage().getBitmap());
            tvStreet.setText(maneuver.getRoadName());
            tvMeters.setText("durante " + maneuver.getDistanceFromPreviousManeuver() + " m");

            if (maneuver.getDistanceToNextManeuver() == 0) {
                tvMeters.setVisibility(View.GONE);
            } else {
                tvMeters.setVisibility(View.VISIBLE);
            }
        }
    }
};

但我没有得到正确的机动文本。例如“在下一个拐角处右转”和相应的箭头图标放在 IMAGEVIEW 中。

谁能帮帮我?

问候。

【问题讨论】:

  • 你能指导我获取当前路线可用的所有机动的列表吗?
  • 上面的代码只给出了下一次机动的信息。我只是想以列表的形式获取机动信息。谁能在这里指导我。

标签: android sdk navigation here-api turn


【解决方案1】:

我假设您提供的图像来自 Google Store 上的 HERE 地图,这是使用 HERE SDK 的自定义实现。

您可以从 Maneuver 获得的说明,查看文档 https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics_api_nlp_hybrid_plus/com-here-android-mpa-routing-maneuver.html#topic-apiref__getinstruction-void

图标也应该从 getIcon() 中检索,它给出了一个枚举,您需要为图标中可能的枚举创建图像,查看文档 https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics_api_nlp_hybrid_plus/com-here-android-mpa-routing-maneuver-icon.html#topic-apiref

【讨论】:

  • 您好,能否告诉我如何将枚举转换为图标?
【解决方案2】:

如果你想得到动作列表,你不能在 NewInstructionEvent 上得到它。 由于您已经在导航中,因此您应该已经有了您的路线对象。在路由对象上,您只需调用 getManeuvers()。这将为您提供当前路线的所有机动列表。

您也可以参考他们的 UI Kit https://developer.here.com/blog/build-beautiful-interfaces-with-the-here-mobile-sdk-ui-kit-for-android-and-ios

希望这会有所帮助。我知道这是一个较旧的线程。

【讨论】:

    【解决方案3】:

    HERE SDK Premium 不提供导航前的机动指令,您也无法在任何时候获得机动指令列表。

    但是,您可以使用 HERE Routing API 获取机动指令列表。

    https://developer.here.com/documentation/routing-api/dev_guide/topics/use-cases/actions.html

    另一种方法是通过 AudioPlayerDelegate.PlayText 回调获取指令。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-20
      • 1970-01-01
      • 1970-01-01
      • 2023-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多