Jamon Holmgren
Jamon Holmgren

Reputation: 24394

iOS: Detect when bluetooth device disconnects when app is not running

I'd like to detect when a bluetooth device or network disconnects, even when my app isn't running.

In Android, you can register to be notified when the bluetooth adapter changes state.

http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#ACTION_CONNECTION_STATE_CHANGED

I don't need to bring the app to the foreground. I just need to record the fact that it disconnected, a timestamp, and some location data. Once the user brings the app back up, I'll be accessing that data to provide them info of where the bluetooth device disconnected.

(I'm using RubyMotion, but that isn't super relevant for this question. Objective-C answers are fine.)

Upvotes: 3

Views: 3175

Answers (1)

Andrew
Andrew

Reputation: 15377

You might want to take a look here for background modes. Will any of those work for you? There are more in ios 7. Some background modes may be compatible with ios 6 as well though. Are you using Core Bluetooth? Theres a background mode for that

Upvotes: 1

Related Questions