Autoconnecting to known BLE device

2019-03-27 23:49发布

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条回答
家丑人穷心不美
2楼-- · 2019-03-28 00:04

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.

查看更多
登录 后发表回答