本文介绍了使用.getSpeedLimit()也会发出警告声.如何覆写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法覆盖此处SDK,以禁用onSpeedExceeded事件上的声音效果.

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

使用Here Developer教程,( https://developer.here.com/blog/android-premium-sdk-speed-limit-warning-example ),我成功运行了示例应用程序.但是...

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.

我猜想我可能会通过创建NavigationManager.SpeedWarningListener来覆盖代码.不幸的是,我无法禁用或击败"onSpeedExceeded"音效.

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

推荐答案

请为NMANavigationManager相应地设置speedWarningEnablednavigationManager:didUpdateSpeedingStatus:forCurrentSpeed:speedLimit:在检测到超速或进行更正时将发送给委托.

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

另请参阅 http://developer.here.com/documentation/ios-premium/api_reference_jazzy/Classes/NMANavigationManager.html

这篇关于使用.getSpeedLimit()也会发出警告声.如何覆写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 04:56