Autoconnecting to known BLE device

2019-03-28 00:10发布

问题:

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.