Capture SDK 设置提示音和振动属性

Capture SDK set beep and vibrate properties

需要使用 Capture SDK 了解 BEEP 和 VIBRATE 设置背后的正确设置。将 DEVICE_RUMBLE_CONFIG 设置为 1 或 0 时,似乎出现错误并且没有任何更改。 DEVICE_SOUND_CONFIG.

同样的问题

if (getBRSharedPreferenceBoolean(PreferencesActivity.PREF_SOCKET_SCANNER_VIBRATE, false)) {
  mDevice.setProperty(Property.create(Property.DEVICE_RUMBLE_CONFIG,1), propertyCallback);
} else {
  mDevice.setProperty(Property.create(Property.DEVICE_RUMBLE_CONFIG,0), propertyCallback);
}

if (getBRSharedPreferenceBoolean(PreferencesActivity.PREF_SOCKET_SCANNER_BEEP, false)) {
  mDevice.setProperty(Property.create(Property.DEVICE_SOUND_CONFIG,1), propertyCallback);
} else {
  mDevice.setProperty(Property.create(Property.DEVICE_SOUND_CONFIG,0), propertyCallback);
}

PropertyCallback propertyCallback = new PropertyCallback() {
        @Override
        public void onComplete(@Nullable CaptureError captureError, @Nullable Property property) {
            if (captureError != null) {
                Log.d("onComplete", String.format("capture error %s", captureError.getMessage()));
            } else {
                if (property != null) {
                    Log.d("onComplete", String.format("property set %d", property.getId()));
                }
            }
        }
    };

我终于明白了...去查看旧代码并意识到我使用了错误的配置 ID。这是正确的……关于下面代码的一个附加说明是,我通过选择 ACTION_ALL 在蜂鸣和振动选项中包含了 FLASH。

if (deviceClient != null) {

            if (beep && vibrate) {
                Property property = Property.create(Property.DEVICE_LOCAL_DECODE_ACTION, LocalDecode.ACTION_ALL);
                deviceClient.setProperty(property, p);
                Log.d("configureSocket", "RUMBLE and BEEP");
            } else if (beep) {
                Property property = Property.create(Property.DEVICE_LOCAL_DECODE_ACTION, LocalDecode.ACTION_BEEP);
                deviceClient.setProperty(property, p);
                Log.d("configureSocket", "BEEP");
            } else if (vibrate) {
                Property property = Property.create(Property.DEVICE_LOCAL_DECODE_ACTION, LocalDecode.ACTION_RUMBLE);
                deviceClient.setProperty(property, p);
                Log.d("configureSocket", "RUMBLE");
            } else {
                Property property = Property.create(Property.DEVICE_LOCAL_DECODE_ACTION, LocalDecode.ACTION_NONE);
                deviceClient.setProperty(property, p);
                Log.d("configureSocket", "NO BEEP OR RUMBLE");
            }
        }