Set device vibration and ringtone
Function table: supportDeviceVibrationRingtone (sub-items: supportVibrationSetting, supportAlarmVolumeSetting, supportCallReminderVolumeSetting)
Description
- The SDK sets
operateto2; you do not need to passoperatewhen constructing the model. typeis required (1~7) and must match the fields you send;0is invalid (see IDODeviceVibrationRingtoneModel).- When bit0 of
typeis set, passvibrationIntensity; bit1 →alarmVolume; bit2 →callReminderVolume. - Check the corresponding sub-item function table before setting that sub-item.
- Use this API; do not use the deprecated
deviceVibrationRingtone.
Example
Swift
let model = IDODeviceVibrationRingtoneModel(
type: 3,
vibrationIntensity: 2,
alarmVolume: 5
)
Cmds.setDeviceVibrationRingtone(model).send { rs in
if case .success(let obj) = rs {
// obj.retCode == 0 means success
} else {
// fail
}
}
Kotlin
val model = IDODeviceVibrationRingtoneModel(
type = 3,
vibrationIntensity = 2,
alarmVolume = 5
)
Cmds.setDeviceVibrationRingtone(model).send {
if (it.error.code == 0) {
// success
// it.res?.retCode == 0
} else {
// fail
}
}
ArkTs
let model = new IDODeviceVibrationRingtoneModel()
model.type = 3
model.vibrationIntensity = 2
model.alarmVolume = 5
Cmds.setDeviceVibrationRingtone(model, (res) => {
if (res.success) {
// success
// res.value is IDODeviceVibrationRingtoneModel
} else {
// fail
}
})