Set device vibration and ringtone

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

Description

  • The SDK sets operate to 2; you do not need to pass operate when constructing the model.
  • type is required (1~7) and must match the fields you send; 0 is invalid (see IDODeviceVibrationRingtoneModel).
  • When bit0 of type is set, pass vibrationIntensity; 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
    }
})
Copyright © 2023-2024 IDO. All rights reserved. all right reserved,powered by Gitbook修改日期: 2026-09-23 02:35:02

results matching ""

    No results matching ""