javascript - react-native-ble-manager 不返回任何内容或永远不会触发事件“handleDiscoverPeripheral”
问题描述
我正在尝试使用此示例获取可用蓝牙设备的列表。
(我不使用模拟器,我通过USB连接了手机。)
这是代码的官方示例。 代码在这里
但是,我看不到任何设备。永远不会触发事件“handleDiscoverPeripheral”。
我应该能够看到至少 2 个设备。
这是我的反应原生日志
info Reloading app...
BUNDLE [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1/1), done.
LOG Running "ArduinoBluetooth" with {"rootTag":1}
WARN VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead.
LOG Permission is OK
LOG Scanning...
LOG Scan is stopped
LOG No connected peripherals
LOG []
LOG Scanning...
PS 我已将扫描秒数增加到 30
BleManager.scan([], 30, true)
此外,所有权限都已设置。
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
解决方案
推荐阅读
- rabbitmq - 使用 MassTransit/RabbitMQ 更改消息优先级
- javascript - 我在 JavaScript 中收到错误“无法读取未定义的属性 'innerHTML'”。请帮忙!我是 JS 新手。代码附在下面。谢谢
- c++ - 例外情况:检查元素是否已存在于数组c++中
- javascript - Fetch API promise - JavaScript 和 HTML 连接
- c++ - 为什么 C++ 标准委员会没有将 std::hash 包含在 pair 和 tuple 中?
- laravel - 您是否需要测试已通过其他测试测试过的功能?
- mysql - MySQL 未知错误(SELECT、LEFT JOIN、AS...)
- google-chrome-extension - 移动设备中的 Chrome 扩展程序通知
- opencv - 使用颜色图将颜色条插入 OpenCV2 图像(视频)流
- wordpress - Wordpress Astra 入门主题 - 500 内部服务器错误