2

I am using here maps android sdk premium version for map navigation in my android app.

I have successfully implemented here maps navigation. While navigating, if I go out of route then reroute calculation occurs and new route to given destination is shown but if I go through a restricted road, then here maps only says rerouting which is true since from restricted road it cannot calculate the route.

But is there any way I can show nearest exit from the restricted road to get a new route to destination on here maps android? Right now, on the restricted roads, no route is shown.

    @Override
    public void onRouteUpdated(@NonNull Route route) {
        Log.d(TAG, "onRouteUpdated: called.");
        //remake new route
        map.removeMapObject(mapRoute);
        // create a new MapRoute object
        mapRoute = new MapRoute(route);
        // display new route on the map
        map.addMapObject(mapRoute);
    }

The above code is not useful while on restricted road. Tried using listener as:

private NavigationManager.RerouteListener rerouteListener = new NavigationManager.RerouteListener() {

    @Override
    public void onRerouteBegin() {
        super.onRerouteBegin();
        Toast.makeText(activity, "reRouteListener begin...", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRerouteEnd(@NonNull RouteResult routeResult, RoutingError routingError) {
        super.onRerouteEnd(routeResult, routingError);
        StringBuilder stringBuilder = new StringBuilder();
        for (RouteResult.ViolatedOption violatedOption: routeResult.getViolatedOptions()) {
            stringBuilder.append(violatedOption.toString());
        }

        Toast.makeText(activity, "routeresult end: " + stringBuilder, Toast.LENGTH_SHORT).show();
    }
};

Sometimes got violated options as START_DIRECTION and sometimes nothing. But still stuck on how to achieve nearest route as such on restricted road.

[update] : I tried suggestion from @Datasun. But I got invalid routing on initiating new route from restricted road (tried from height restricted road). My problem is while navigating, if user goes to restricted road, the route disappears and it says route recalculating. I want to show user nearest exit from the restricted road or some notification that they are on restricted road. Right now I'm getting violated options of START_DIRECTION but sometimes nothing on the restricted road. What am I missing?

Ujjwal Jung Thapa
  • 604
  • 2
  • 8
  • 31
  • Can you eloborate more on the problem? For example, when you are on a restricted route, you can simply start calculating a new route from your current location (wherever that is). The starting point should indicate the nearest "exit", meaning a car route will start on the next unrestricted route. – Nusatad Jan 10 '22 at 07:47
  • @Datasun Thank you. I tried your suggestion. But I got invalid routing on initiating new route from restricted road (tried from height restricted road). – Ujjwal Jung Thapa Jan 10 '22 at 20:31
  • I have only tested the newer Navigate Edition, so I cannot say for sure how it behaves for the older Premium Edition, but maybe it is worth to give the newer edition a try: https://developer.here.com/documentation/android-sdk-navigate. – Nusatad Jan 13 '22 at 07:16
  • To confirm, the issue is not reproducible on navigate SDK? which navigate SDK version are you using? what is the version of premium SDK? Could you implement/share an example implemented in one of our sample app from the below git link: https://github.com/heremaps/here-android-sdk-examples –  May 16 '22 at 14:50

1 Answers1

0

To summarize, within the Navigate SDK the issue is not reproducable any more.

In general the HERE Premium SDK (3.x) is superseded by new 4.x SDK variants and the Premium SDK will be maintained until 31 December 2022 with only critical bug fixes and no feature development / enhancements.

Current users of the HERE Premium SDK (3.x) are encouraged to migrate to Lite, Explore or Navigate HERE SDK (4.x) variants based on licensed use cases before 31 December 2022. Most of the Premium SDK features are already available in the new SDK variants.