生成自动已知BLE装置 [英] Autoconnecting to known BLE device
问题描述
我知道,在connectGatt自动连接设置为true,将无法重新连接我的设备,如果我在两者之间一个大的时间框架走出去,在范围内一次。我的问题是,我怎么能不重新连接的android保持清醒,避免杀死我的电池?
I know that setting autoConnect to true in connectGatt won't reconnect my device if i get out and in range again with a big time frame in between. My question is, how can i reconnect without maintaining android awake, and avoid killing my battery?
推荐答案
我觉得<一个href=\"http://stackoverflow.com/questions/36915530/how-android-system-autoconnects-to-paired-device\">my为(我的)类似的问题的解决方案可能的帮助。只需保存BLE设备的MAC地址到DB或东西,以及当它需要使用MAC地址连接。您可以拨打 connectGatt()
周期性,当应用程序启动时,或者当它初始化的东西。
I think my solution for similar question (of me) might help. Just save the MAC address of the BLE device into DB or something, and connect by using the MAC address when it needed. You can call connectGatt()
periodically, when the app starts, or when it initializes something.
这篇关于生成自动已知BLE装置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!