Using .getSpeedLimit() also makes warning sounds . How to Override?

Deadly 提交于 2021-01-29 18:53:03

问题


Unable to override Here SDK to disable sound effect on the onSpeedExceeded event.

Using the Here Developer tutorial, (https://developer.here.com/blog/android-premium-sdk-speed-limit-warning-example), I succeeded in running the sample app. But...

While driving, when I exceed the speed limit, there is a doot doot doot. I want to override this behaviour as I intend to use my own sounds.

I guessed that I might override the code by creating a NavigationManager.SpeedWarningListener. Unfortunately I can not disable or defeat the 'onSpeedExceeded' sound effects.

NavigationManager.SpeedWarningListener speedWarningListener = new NavigationManager.SpeedWarningListener() {
    @Override
    public void onSpeedExceeded(String s, float v) {
        //super.onSpeedExceeded(s, v);
        //Log.v(Global.TAG, "onSpeedExceeded");
        Global.SpeedLimitExceeded = true;
    }

    @Override
    public void onSpeedExceededEnd(String s, float v) {
        //super.onSpeedExceededEnd(s, v);
        //Log.v(Global.TAG, "onSpeedExceededEnd");
        Global.SpeedLimitExceeded = false;
    }
};

EDITED ANSWER: This method needs to be amended to stop the speed warning:

private void startNavigationManager() {
    NavigationManager.Error navError = NavigationManager.getInstance().startTracking();

    // added by suggestion from stackoverflow
    NavigationManager.getInstance().stopSpeedWarning();

    if (navError != NavigationManager.Error.NONE) {
        Log.d(Global.TAG, "NavigationManager: false");
        //handle error navError.toString());
    } else {
        //Log.d(Global.TAG, "NavigationManager: true");
    }
}

回答1:


Please set speedWarningEnabled accordingly for NMANavigationManager navigationManager:didUpdateSpeedingStatus:forCurrentSpeed:speedLimit: will be sent to the delegate when speeding is detected or when a correction is made.

Also refer http://developer.here.com/documentation/ios-premium/api_reference_jazzy/Classes/NMANavigationManager.html



来源:https://stackoverflow.com/questions/58349692/using-getspeedlimit-also-makes-warning-sounds-how-to-override

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!