Nhảy tới nội dung

getBeacons

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

Lấy tất cả các thiết bị đã tìm thấy.

Parameters

Object object

PropertyTypeDefaultRequiredDescriptionMinimum Version
successfunctionCallback function khi gọi api thành công
failfunctionCallback function khi gọi api thất bại

Return Values

Object res

PropertyTypeDescriptionMinimum Version
beaconsArray<iBeaconInfo>Danh sách thiết bị

Entities

iBeaconInfo

PropertyTypeDescriptionMinimum Version
uuidstringBroadcast UUID của thiết bị
majorstringID chính của thiết bị
minorstringID thứ 2 của thiết bị
distancenumberKhoảng cách tới thiết bị
rssinumberCường độ tín hiệu của thiết bị

Sample Code

import api from 'zmp-sdk';

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

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