I am dealing with External Accessories and MFI for a project and have this question:
What 3rd party hardware attributes, if any, can be recognized after connecting an iOS device to the MFI hardware? Specifically, I am looking for a generic way to determine the device classes or capabilities rather than having to check the specific manufacturer and device names, similar to how Android can do it (see below). Is this possible?
http://developer.android.com/reference/android/bluetooth/BluetoothClass.Device.html
The end goal: Toggle a boolean when connected to an audio dock; ignore other events. I’m not sure how granular iOS can get. Can iOS tell the difference between an audio dock and a Golf Putter App Cradle ? Does MFi grant insight into the capabilities of a device?
I will be targeting iOS 4.2+.
You can request to get notifications by the
EAAccessoryManagerclass (viaregisterForLocalNotificationsmethod). To do so, you need to add theExternalAccessory.frameworkto your project.Once a hardware is added, you get a notification with
EAAccessoryKey, what in turn can be used to get anEAAccessoryfrom the accessory managerThe accessory has a number of properties that should help to identify which kind of hardware have been connected:
I have no idea, what your audio dock provides here, but it should easy to simply try and hope that it is consistent for all devices 🙂
If you are not interested in a specific device but in a class of devices (with a specific behavior),
protocolStringsshould be useful. The array consists of strings that name protocols (in sense of behaviors, not in ObjectiveC sense). The names are formatted as reverse-DNS strings (com.mycompany.myprotocol).If you provide one or more of such protocol names in the
UISupportedExternalAccessoryProtocolssection (type: array of strings) of your app’sInfo.plistfile, your app will be started if a proper device is connected.