简体   繁体   中英

HERE Android SDK Turn by turn instruction

I am using HERE Android SDK to perform turn by turn navigation project. But I do not get the result similar to image.

在此处输入图片说明

I hava this code to get the current 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);
            }
        }
    }
};

But I do not get the correct text of the maneuver. For example "Turn right at the next corner" and the and the corresponding arrow icon to put inside IMAGEVIEW.

can anybody help me?

Regards.

I assume the image you provided is from HERE Maps available on Google Store which is a custom implementation using the HERE SDK.

The instruction you can get from Maneuver , check documentation 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

Icon should also be retrieved from getIcon() , which gives an enumeration and you will need to create images for possible enumerations in the icon , check documentation 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

If you want to get the list of maneuvers, you can't get it on the NewInstructionEvent. Since you are already in navigation you should already have your route object. On the route object you can just call getManeuvers(). That will give you all the list of maneuvers for the current route.

You can also refer to their UI Kit https://developer.here.com/blog/build-beautiful-interfaces-with-the-here-mobile-sdk-ui-kit-for-android-and-ios .

Hope this helps. I know this is an older thread.

HERE SDK Premium does not provide Maneuver Instructions pre- start of Navigation nor can you get a list of Maneuver Instructions at any point.

You however could get a list of Maneuver Instructions using the HERE Routing API.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM