Nhảy tới nội dung

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

  • SDK: 2.9.8
Lưu ý

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 { vibrate } from "zmp-sdk/apis";

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

import { vibrate } from "zmp-sdk/apis";

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