Goal:
I'm trying to get my android service to auto-connect to an already paired bluetooth device when its in range.
Example:
I have my iphone paired to my car. When I sit down in my car music starts automatically playing. I don't need to connect it again. I don't need to start a song. It just launches itunes and starts playing music. I want this kind of connectivity in my Android application.
One obvious solution is to have a thread running in a background services that tries to connect every X seconds. This however is not optimal due to the toll on battery life.
I tried setting up broadcast receivers to get triggered on ACTION_ACL_CONNECTED
but this seems to only get called after I connect to the device.
Is there no way my app can get a notification when the phone walks into range of the device?
I've spent the better part of the last two days trying to get this to work with no luck. There are a billion tutorials on how to connect to a bt device but none to auto connect when in range. Starting to question if this even possible.. I'll be blown away if its not :(
related questions:
Find already paired bluetooth devices automatically, when they are in range