0

I've been looking around a lot at the best way to connect to a paired Bluetooth device when it comes back in range, and so far I have a background service that cycles through all of the paired devices and attempts to connect to them every 10 seconds or so.

I was wondering if there was a better way to accomplish this, such as receiving a message when it comes back in range, so that I wouldn't have my device constantly attempting to connect to devices and draining battery life. I've found that ACTION_FOUND doesn't work consistently for paired devices, but maybe there's something I'm missing.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Jacob Frey
  • 3
  • 1
  • 3

1 Answers1

0

You haven't really mentioned whether you have any control over the Bluetooth device's stack or not, but if you do, a lot of Bluetooth modules have built-in auto-reconnect functionality.

I've used this module before: http://www.ampedrftech.com/guides/abSerial_RefGuide.pdf

In this case, it will automatically attempt a reconnect from the device side.

SJoshi
  • 1,866
  • 24
  • 47
  • The app I'm making is designed to be able to connect to almost any bluetooth device, so I haven't looked too much into BLE since I would have to support standard bluetooth and low energy. I'm also pretty new to coding with bluetooth, so would it be worth it to use BLE and utilize their auto reconnect? – Jacob Frey Aug 06 '15 at 21:46
  • The link I provided was a BT Classic device, not BLE – SJoshi Aug 07 '15 at 05:00