I had what I thought would be a relatively simple requirement to start a service if a previously paired Blue Tooth Address the details of which I had stored in preferences was connected to the device. I have tried using a Broadcast Receiver to check when a device connects but that only works on some phones, others don't return any information about the device or the receiver is never called. So I have an Alarm that goes off and checks to see if the device is connected at regular points. I don't need anything from the device or its services but to know that it is connected.
I can get the device from the paired devices easily enough but I just need to know one thing. Is it connected at that moment in time? When I check the connection state with the device manager it always says disconnected despite the device being connected.
I admit to being fairly ignorant of the ins and outs of Bluetooth Devices and connecting to them but I didn't really think I would have to become an expert to fulfill what seemed like a simple requirement on the surface.
Is there a relatively simple, efficient solution to this that I am missing?