【问题标题】:Capture SDK set beep and vibrate properties捕获 SDK 设置蜂鸣和振动属性
【发布时间】:2019-08-13 23:24:00
【问题描述】:

需要了解使用 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()));
                }
            }
        }
    };

【问题讨论】:

    标签: android socketmobile capture-sdk


    【解决方案1】:

    我终于弄明白了...去查看旧代码并意识到我使用了错误的配置 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");
                }
            }

    【讨论】:

      猜你喜欢
      • 2014-03-30
      • 1970-01-01
      • 1970-01-01
      • 2021-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-21
      相关资源
      最近更新 更多