Query device vibration and ringtone

Function table: supportDeviceVibrationRingtone (sub-items: supportVibrationSetting, supportAlarmVolumeSetting, supportCallReminderVolumeSetting)

Description

  • The SDK sets operate to 1.
  • type is optional: omit it to query all supported sub-items based on the function table; when provided, only the bits set in the mask are queried (1~7; see IDODeviceVibrationRingtoneModel).
  • Check supportDeviceVibrationRingtone before calling; also check the corresponding sub-item flag before querying that sub-item.
  • Use this API; do not use the deprecated deviceVibrationRingtone.

Example

Swift

// Query all supported sub-items based on the function table
Cmds.getDeviceVibrationRingtone().send { rs in
    if case .success(let obj) = rs {
        // obj is IDODeviceVibrationRingtoneModel
        // Use obj.type to decide whether vibrationIntensity / alarmVolume etc. are valid
    } else {
        // fail
    }
}

// Query vibration intensity only
Cmds.getDeviceVibrationRingtone(type: 1).send { rs in
    if case .success(let obj) = rs {
        // success
    } else {
        // fail
    }
}

Kotlin

// Query all supported sub-items based on the function table
Cmds.getDeviceVibrationRingtone().send {
    if (it.error.code == 0) {
        // success
        // it.res is IDODeviceVibrationRingtoneModel
    } else {
        // fail
    }
}

// Query vibration intensity only
Cmds.getDeviceVibrationRingtone(1).send {
    if (it.error.code == 0) {
        // success
    } else {
        // fail
    }
}

ArkTs

Cmds.getDeviceVibrationRingtone((res) => {
    if (res.success) {
        // success
        // res.value is IDODeviceVibrationRingtoneModel
    } else {
        // fail
    }
})
Copyright © 2023-2024 IDO. All rights reserved. all right reserved,powered by Gitbook修改日期: 2026-09-23 02:35:02

results matching ""

    No results matching ""