protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        initializeHERESDK();


        herePositioningProvider = new HEREPositioningProvider();

        try {
            visualNavigator = new VisualNavigator();

            Toast.makeText(this,"VisualNavigator created",Toast.LENGTH_SHORT).show();
        } catch (InstantiationErrorException e) {
            Toast.makeText(this,"VisualNavigator Error",Toast.LENGTH_SHORT).show();
            throw new RuntimeException("Initialization of VisualNavigator failed: " + e.error.name());
        }

        visualNavigator.setSpeedLimitListener(new SpeedLimitListener() {
            @Override
            public void onSpeedLimitUpdated(@NonNull SpeedLimit speedLimit) {
                
                Log.d(TAG, "onSpeedLimitUpdated: inside");

                Double currentSpeedLimit = getCurrentSpeedLimit(speedLimit);

                if (currentSpeedLimit == null) {
                    Log.d(TAG, "Warning: Speed limits unknown, data could not be retrieved.");
                } else if (currentSpeedLimit == 0) {
                    Log.d(TAG, "No speed limits on this road! Drive as fast as you feel safe ...");
                } else {
                    Log.d(TAG, "Current speed limit (m/s):" + currentSpeedLimit);
                }
            }
        });

        visualNavigator.setRoadTextsListener(new RoadTextsListener() {
            @Override
            public void onRoadTextsUpdated(@NonNull RoadTexts roadTexts) {
                Toast.makeText(getBaseContext(),"onRoadTextsUpdated",Toast.LENGTH_SHORT).show();
                // See getRoadName() how to get the current road name from the provided RoadTexts.
            }
        });

        visualNavigator.setRoute(null);
        herePositioningProvider.startLocating(visualNavigator, LocationAccuracy.NAVIGATION);

........................

}

Here SDK (Navigate Edition) v4.15.1.0

Sample Code : https://github.com/heremaps/here-sdk-examples/tree/master/examples/latest/navigate/android/Navigation

SpeedLimitListener Docs: https://developer.here.com/documentation/android-sdk-navigate/4.15.1.0/dev_guide/topics/navigation.html#receive-speed-limit-events

Note : accessKeyId and accessKeySecret are there and working.

We are using this code for getting the speed limit, as in Navigation example, but onSpeedLimitUpdated() callback, never gets called.

We are getting following the logs: "HerePositioningClient com.here.driverapp D onLocationRequestFailed: PositioningError[posClientStatus:4|status:4|details:0x1]"

Seems like the location is not being updated and thus no callback for speed limit, however, even if the location was not being sent to SDK, ideally it should have called the callback for SpeedLimitListener.

How do i find out what is actually wrong and fix it. Thanks

0

There are 0 best solutions below