Is it possible to be notified when a Bluetooth Device is connected or disconnected from iOS even when my app is in background ?
On Android, I use the ACTION_ACL_CONNECTED
and ACTION_ACL_DISCONNECTED
events. But I cannot find equivalents for iOS.
I found the CBCentralManager
that can be used to monitor Bluetooth events, but my functions aren't called when a bluetooth device is connected/disconnected, only when I enable/disable the bluetooth. Is it an error on my side or is it normal ?
I also found the doc about Audio Route changes, that can also be an idea to detect the bluetooth connections/disconnections. Just check the kind of new route and detect the connected bluetooth devices at that time.
In the doc, I also found NSNotification
types like IOBluetoothHostControllerXXX
but nothing is explained about them. Did someone already used them ?
Is there something better or am I missing something ?