Nhảy tới nội dung

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

const getBeaconsDevices = () => {
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

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

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