此处 Android SDK 转弯指令

HERE Android SDK Turn by turn instruction

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

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

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);
            }
        }
    }
};

但是我没有得到演习的正确文本。例如 "Turn right at the next corner" 和相应的箭头图标放在 IMAGEVIEW 中。

有人可以帮我吗?

此致。

我假设您提供的图像来自 Google 商店中提供的 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

想要获取动作列表,在NewInstructionEvent上是获取不到的。 由于您已经在导航中,因此您应该已经有了路线对象。在路线对象上,您可以调用 getManeuvers()。这将为您提供当前路线的所有演习列表。

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

希望这对您有所帮助。我知道这是一个较旧的话题。

HERE SDK Premium 不提供导航开始前的机动指令,您也无法随时获得机动指令列表。

然而,您可以使用 HERE 路线获取机动指令列表 API。

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

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