Query device vibration and ringtone
Function table: supportDeviceVibrationRingtone (sub-items: supportVibrationSetting, supportAlarmVolumeSetting, supportCallReminderVolumeSetting)
Description
- The SDK sets
operateto1. typeis 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
supportDeviceVibrationRingtonebefore 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
}
})