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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.