Nhảy tới nội dung

vibrate

Bắt đầu hỗ trợ ở phiên bản:

  • API: 2.9.8
Lưu ý

Với API version ﹤ 2.23.0, phải gọi api login trước khi gọi api này và cần xin cấp quyền tại trang Quản lý ứng dụng

Kích hoạt chế độ rung trên thiết bị.

Parameters​

Object object​

PropertyTypeDefaultRequiredDescriptionMinimum Version
millisecondsnumber500Thời gian rung. Chỉ có thể thiết lập trên thiết bị android
successfunctionCallback function khi gọi api thành công
failfunctionCallback function khi gọi api thất bại

Sample Code​

import api from 'zmp-sdk';

api.vibrate({
milliseconds: 1000,
success: (data) => {
// xử lý khi gọi api thành công
},
fail: (error) => {
// xử lý khi gọi api thất bại
console.log(error);
}
});

// hoặc
const test = async () => {
try {
const data = await api.vibrate({
milliseconds: 1000
});
} catch (error) {
// xử lý khi gọi api thất bại
console.log(error);
}
};