getDeviceIdAsync
Bắt đầu hỗ trợ ở phiên bản:
- API: 2.20.0
API trả về chuỗi Device ID của thiết bị đã được hash. Các tài khoản người dùng khác nhau đăng nhập trên cùng 1 thiết bị và sử dụng cùng 1 Mini App (hoặc các Mini App có chung Zalo App ID) sẽ có giá trị Device ID giống nhau.
Parameters
Object object
Property | Type | Default | Required | Description | Minimum Version |
---|---|---|---|---|---|
success | function | Callback function khi gọi api thành công | |||
fail | function | Callback function khi gọi api thất bại |
Return Values
Promise<String data>
Sample Code
import { getDeviceIdAsync } from "zmp-sdk/apis";
const getId = () => {
getDeviceIdAsync({
success: (id) => {
console.log(id);
},
fail: (error) => {
console.log(error);
}
});
};
Hoặc
import { getDeviceIdAsync } from "zmp-sdk/apis";
const getId = async () => {
try {
const deviceId = await getDeviceIdAsync();
} catch (error) {
console.log(error);
}
};