【发布时间】:2025-12-06 23:55:01
【问题描述】:
使用https://github.com/MacKentoch/react-native-beacons-manager
在 iOS 上运行良好,但在 Android 上,在我开始测距信标后,信标阵列中没有任何内容(我旁边有 6 个信标,它们都显示在 iOS 上)。
这就是我正在做的事情:
componentDidMount() {
// Start detecting all iBeacons in the nearby
Beacons.detectIBeacons();
Beacons.startRangingBeaconsInRegion('Estimotes', 'B9407F30-F5F8-466E-AFF9-25556B57FE6D').then((data)=>{
console.log(data);
}).catch((reason) => {
console.log(reason);
});
// Print a log of the detected iBeacons (1 per second)
DeviceEventEmitter.addListener('beaconsDidRange', (data) => {
console.log(data);
});
}
在我的控制台中,我得到了这个:
{beacons: Array(0), uuid: "b9407f30-f5f8-466e-aff9-25556b57fe6d", identifier: "Estimotes"}
我将 Estimotes 的 UUID 保留为默认值,所以这应该可以工作。使用三星 Galaxy S8+ 进行测试。我在这里做错了什么编码吗?我在 Android 上是否缺少其他权限?蓝牙和定位服务已打开。
【问题讨论】:
标签: android react-native ibeacon