- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我有一个应用程序在运行 Android 4.3 的三星 S3 上运行良好,但我在运行 4.4.4 的 Moto G 上遇到问题
我的 BLE 外围设备在应用程序使用过程中连接和断开连接多次。这工作正常,但有时会出现应用程序/手机不再重新连接到外围设备的情况。
所有 gatt 命令都在主线程上运行,eg.
final BluetoothGatt gat = gatt;
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
// This code will be executed on the main thread
if (Looper.myLooper() == Looper.getMainLooper()) {
Log.e(TAG, "mGattCallback disconnect2: NOW ON MAIN THREAD :)");
}
gat.disconnect();
}
});
并且外围设备断开连接正常。当发生这种情况并且我无法再重新连接到外围设备时,我会收到大量这样的日志:
04-07 16:57:56.798: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:56.798: I/bt-hci(2127): btu_ble_process_adv_pkt
04-07 16:57:56.833: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:56.833: I/bt-hci(2127): btu_ble_process_adv_pkt
04-07 16:57:56.871: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:56.871: I/bt-hci(2127): btu_ble_process_adv_pkt
04-07 16:57:56.906: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:56.906: I/bt-hci(2127): btu_ble_process_adv_pkt
04-07 16:57:56.941: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:56.941: I/bt-hci(2127): btu_ble_process_adv_pkt
04-07 16:57:56.977: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:56.977: I/bt-hci(2127): btu_ble_process_adv_pkt
04-07 16:57:57.016: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:57.016: I/bt-hci(2127): btu_ble_process_adv_pkt
我需要退出该应用程序,关闭蓝牙然后重新打开,以便它再次开始正常工作。
有任何已知问题、提示或建议吗?
谢谢
编辑------------经过更多测试后,似乎让应用程序继续运行,最终我得到以下日志,然后我的外围设备可以再次重新连接:
04-13 19:11:53.973: I/bt-hci(2034): BLE HCI(id=62) event = 0x02)
04-13 19:11:53.973: I/bt-hci(2034): btu_ble_process_adv_pkt
04-13 19:11:54.076: I/bt-hci(2034): BLE HCI(id=62) event = 0x02)
04-13 19:11:54.076: I/bt-hci(2034): btu_ble_process_adv_pkt
04-13 19:11:55.986: I/bt-hci(2034): BLE HCI(id=62) event = 0x02)
04-13 19:11:55.986: I/bt-hci(2034): btu_ble_process_adv_pkt
04-13 19:11:56.087: I/bt-hci(2034): BLE HCI(id=62) event = 0x02)
04-13 19:11:56.087: I/bt-hci(2034): btu_ble_process_adv_pkt
04-13 19:11:56.629: I/bt-hci(2034): BLE HCI(id=62) event = 0x02)
04-13 19:11:56.629: I/bt-hci(2034): btu_ble_process_adv_pkt
04-13 19:11:56.734: I/bt-hci(2034): BLE HCI(id=62) event = 0x02)
04-13 19:11:56.734: I/bt-hci(2034): btu_ble_process_adv_pkt
04-13 19:11:58.925: D/MDMCTBK(275): reply_len: 40 reply is = IFNAME=wlan0 <3>CTRL-EVENT-SCAN-RESULTS
04-13 19:11:58.925: D/MDMCTBK(275): Event received = CTRL-EVENT-SCAN-RESULTS
04-13 19:11:58.926: D/WifiStateMachine(1010): handleMessage: E msg.what=147461
04-13 19:11:58.926: D/WifiStateMachine(1010): processMsg: DisconnectedState
04-13 19:11:58.926: D/WifiStateMachine(1010): processMsg: ConnectModeState
04-13 19:11:58.926: D/WifiStateMachine(1010): processMsg: DriverStartedState
04-13 19:11:58.927: D/WifiStateMachine(1010): processMsg: SupplicantStartedState
04-13 19:11:58.928: D/TCMD(4253): NL - Read 56 bytes from update socket.
04-13 19:11:58.928: D/TCMD(4253): NL - message type is RTM_NEWLINK
04-13 19:11:58.928: D/TCMD(4253): Listening for incoming client connection request
04-13 19:35:18.787: V/AlarmManager(1010): sending alarm Alarm{42b84cc0 type 2 com.google.android.gms}
04-13 19:35:18.787: V/AlarmManager(1010): sending alarm Alarm{42b83a00 type 0 android}
04-13 19:11:58.941: D/WifiStateMachine(1010): handleMessage: X
04-13 19:12:00.615: D/WifiStateMachine(1010): handleMessage: E msg.what=131143
04-13 19:12:00.615: D/WifiStateMachine(1010): processMsg: DisconnectedState
04-13 19:12:00.616: D/WifiStateMachine(1010): processMsg: ConnectModeState
04-13 19:12:00.617: D/WifiStateMachine(1010): processMsg: DriverStartedState
04-13 19:12:00.628: D/WifiStateMachine(1010): handleMessage: X
04-13 19:12:01.425: D/MDMCTBK(275): reply_len: 40 reply is = IFNAME=wlan0 <3>CTRL-EVENT-BSS-REMOVED 1
04-13 19:12:01.425: D/MDMCTBK(275): Event received = CTRL-EVENT-BSS-REMOVED 1
04-13 19:12:01.425: D/MDMCTBK(275): reply_len: 40 reply is = IFNAME=wlan0 <3>CTRL-EVENT-SCAN-RESULTS
04-13 19:12:01.425: D/MDMCTBK(275): Event received = CTRL-EVENT-SCAN-RESULTS
04-13 19:12:01.425: D/WifiStateMachine(1010): handleMessage: E msg.what=147461
04-13 19:12:01.426: D/WifiStateMachine(1010): processMsg: DisconnectedState
04-13 19:12:01.426: D/WifiStateMachine(1010): processMsg: ConnectModeState
04-13 19:12:01.426: D/WifiStateMachine(1010): processMsg: DriverStartedState
04-13 19:12:01.426: D/WifiStateMachine(1010): processMsg: SupplicantStartedState
04-13 19:12:01.428: D/MDMCTBK(275): reply_len: 40 reply is = IFNAME=p2p0 <3>CTRL-EVENT-BSS-REMOVED 1
04-13 19:12:01.428: D/MDMCTBK(275): Event received = CTRL-EVENT-BSS-REMOVED 1
04-13 19:12:01.428: D/TCMD(4253): NL - Read 56 bytes from update socket.
04-13 19:12:01.428: D/TCMD(4253): NL - message type is RTM_NEWLINK
04-13 19:12:01.428: D/TCMD(4253): Listening for incoming client connection request
04-13 19:12:01.444: D/WifiStateMachine(1010): handleMessage: X
貌似和WiFi有关?!
最佳答案
我认为不会有像“使用主线程”这样简单的答案,一切都很好。但我可以给你一些我在使用糟糕的 Android BLE 时收集到的提示:
will work only with Samsung Galaxy S5, HTC One M8, HTC One, LG Nexus 4, LG Nexus 5, LG Nexus 6, Samsung Note 4, Motorola Moto X and certainly will not work with Moto G
Bluedroid continues to mature and stabilize; there were 565 commits to the bluedroid project alone from 4.4 -> 5.0, compared with 52 commits from 4.3 -> 4.4, and 47 commits from 4.2 -> 4.3.* This is an area of heavy activity within AOSP right now.
关于Android 4.4.4 Moto G Bluetooth LE 重新连接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29495989/
当我向我的安装程序添加依赖项时,我总是留下文件的硬编码路径。 根据 this blog ,解决此问题的唯一方法是使用 ISProjectFolder 变量手动更改 ISL 文件中的硬编码路径。这没有任
我想开发像蓝牙 LE 外围设备这样的应用程序,它停止在与蓝牙 LE 中央设备连接时做广告,并限制与多个蓝牙 LE 中央设备连接的蓝牙 LE 外围设备。 一个蓝牙 LE 外围设备一次只能与一个蓝牙 LE
示例代码: # Step 1 $start = get-date for($i=1; $i -le 1000000; $i++){} $end = get-date ($end-$start).Tot
在Basic customisation ,python 文档说明了比较方法: [no swapped-argument versions of these methods]; rather, __l
蓝牙双模设备是否可以在与 BT LE 设备配对的同时被经典蓝牙发现?如果设备不能同时运行这两种模式也没关系,但我真的应该在这些模式之间切换芯片吗?我只是在 BT 4 Core 规范中找不到答案 最佳答
我正在尝试使用 fscanf 从输入文件中读取 3 个 double 值,但在尝试这样做时遇到了段错误。我的代码如下: FILE * infile = fopen(argv[1], "r");
我的域指向另一个网站,我想为其安装 LE 证书,这可能吗,或者我的域应该链接到服务器? 最佳答案 letsencrypt 不允许安装非 NS 指向,因为它检查反向验证,所以它会失败 关于wordpre
在我的 Android(API 版本 21 及更高版本)Bluetooth LE 应用程序中,该应用程序首先使用 BluetoothLeScanner 和 ScanCallback 对象扫描外围设备。
我正在使用 Xamarin 和这个 BLE 插件构建一个 iOS 应用程序: https://github.com/aritchie/bluetoothle 我只是通过 BLE 广播一个 UUID,它
我可以在点击时同时扫描蓝牙和蓝牙 LE 设备吗? 最佳答案 答案是否定的。 原文来自: http://developer.android.com/guide/topics/connectivity/b
关于 Dennis Mathews answer,您如何在 iOS 上指定经典蓝牙而不是 LE?有没有和Core Bluetooth Framework?不同的api 最佳答案 Joels 有一种在
我有一个使用 BLE 的应用程序。在某些情况下,例如当安装在 iPhone 6 上时,应用程序正在运行并且不请求使用 BLE 的许可。 在其他情况下,比如我的 iPad Air,应用程序开始运行,并且
我尝试使用 Bluetooth LE 检测设备,按照 Xamarin 库中的说明执行此操作,但设备发现 0 包括 android 中的必要声明。将扫描时间增加到 30 秒,但没有任何效果。支持蓝牙,版
配对“普通”蓝牙设备和配对蓝牙 LE 设备之间是否存在任何(大)技术差异? 我找到了很多关于蓝牙 LE 配对的信息,但没有正常的?例如 Info 1 . 那么普通蓝牙的这个信息也正确吗? 最佳答案 如
我尝试使用下面的代码将发现的设备的UUID存储到Array,然后在该阵列中选择UUID进行连接,但无法运行。 - (void)centralManager:(CBCentralManager *)ce
我正在研究一个通过蓝牙 LE 发送数据的 Android 应用程序。这里有两种方法让我感到困惑。有人可以解释一下这两种方法及其相互关系吗: private String localmessage =
我在使用 BluetoothLeScanner 的 startScan 方法时遇到了问题,找到了一个 BLE 设备,但是当我关闭 BLE 设备时,我的手机仍然显示此设备已打开!! 我尝试过使用: pr
我使用 StartLeScan 已经有一段时间了,扫描后返回的设备的名称从未被填充。我永远无法弄清楚为什么,我只是找回了 mac 地址。今天我从 OS BT 设置页面运行扫描,它只显示 MAC 地址,
在实现大量使用 Service 的 Android 应用程序方面,我不是很有经验,而且我在 SO 或 github 上找不到任何好的建议或示例来帮助我(或者只是谷歌搜索)所以我决定问我自己的问题。 当
开发用于蓝牙技术的移动应用程序能否用于蓝牙 LE 技术? 或者开发人员是否需要修改代码来处理蓝牙 LE(智能)信号、输入、输出等? 编辑 问这个问题的时候我想知道 如果我写一段代码,我可以在 BLE
我是一名优秀的程序员,十分优秀!