How to launch an iphone app when an external accessory is either paired over BT or plugged into dock connector - iphone

I have researched this to death online and cannot find anything regarding auto launching an iphone app when an external accessory is either paired using BT or plugged into the dock connector.
We are an MFi developer with a BT accessory and application that we would like to launch when paired. We have the Info.plist containing our protocols and the device containing the correct protocol all working and communicating. The application works well with our BT device, however I would like to see the app launch when paired.
I have seen this before with accessories plugged into the connector and would live to know how that is accomplished.
http://www.metacafe.com/watch/5772611/ces_2011_withings/
Check at 3:15 in the video.
Does iPhone just have that ability for dock connected items to auto start?
I know that the External Accessory framework registers the protocol with the iPhone when the app is installed. This is how the iPhone/iPod knows to take you to the apple store when you connect a BT (or connector) device and you don't have an app for your connected devices protocol.
I don't understand why the app does not launch when paired, I would think this would be a no brainer. Can someone please shed some light on this topic. The best I found is from Apples docs:
Applications that are able to communicate with an external accessory should declare the ?protocols they support in their Info.plist file. Declaring support for specific protocols lets the system know that your application can be launched when that accessory is connected. If no application supports the connected accessory, the system may choose to launch the App Store and point out applications that do."
I cannot understand the meaning by "may choose to launch", does this mean is also chooses to launch? Please help.

The manufacturer of the device needs to include support for this feature at the firmware level. The details of this process are currently confidential by way of the MFi (Made For iPhone/iPod) non disclosure agreement, so unfortunately that is all the detail I can provide. Good luck!

Related

Create an iPad app that can send/receive data via the USB cable?

I want to create an iPad app that connects to another machine, laptop or otherwise, via USB and communicates to some other application I develop running there.
I know that this is easy to achieve via Bluetooth or WiFi but this particular set of solutions must be done via a USB cable.
Is it possible to do so without access to the Apple MFi program? (I am about 5 weeks in and the response is not looking good).
iOS App --> USB Cable --> Mac OSX --> Desktop App (without MFi access)
Thanks
To use USB communication Apple does not provide any API within IOS SDK. The only option right now is MFI. I don't think Apple will allow this in near future.
To use serial communication, you need MFI as you may have discovered. However, there is a poor man's way of achieving this. I have done so during development.
Enable "Internet sharing" on your device and connect to it. Use "ifconfig" on your Mac to find out the interface to use. You do not need to use this as the default connection, but it needs to be active. If I remember correctly, only one end can initiate connections (it was a while so I am sorry that I don't remember the details).
EDIT: I would also like to point out that I did this on an iPhone, not an iPad.
Not over USB but over RS232 (serial port)
Look here: http://www.redpark.com/c2db9.html
But:
The cable uses the old 30 pin connector, but according to them it's compatible with the Lightning adapter
The application won't be accepted on the AppStore, it's for internal use only.
There is a (small) book that explains how to use this cable to connect an iPhone directly to an Arduino, it's been published in late 2011. "iOS Sensor Apps with Arduino Wiring the iPhone and iPad into the Internet of Things" http://shop.oreilly.com/product/0636920021179.do

Control Bluetooth audio device with iPhone

I am looking to write application for iPhone which will be able to control radio and CD player in car. Radio and player have Bluetooth connection available.
I started this question in order to obtain all informations I need for this one one place. I have few questions, but if you find anything I didn't ask important for me to start developing this application, please, let me know.
I have read about AVRCP profile and Bluetooth device in car supports AVRCP 1.3, which is good enough for me, having in mind controls which can be performed in that protocol version.
I read a lot about people saying "Apple device can only interact with each other", "Apple device can't be connected via Bluetooth to non-Apple device", "MFi program is obligatory if you want to do that", "MFi is not needed", etc. My first question is:
1)Is it even possible to pair iPhone (4, 4S) with radio and CD player in car via Bluetooth and control radio stations and music with any iPhone version? If yes, what are the limitations for making this kind of successful Bluetooth connection?
There is also very few informations about roles in which iPhone can work. For AVRCP there are two kind of roles: controller and target role. By reading this paper: https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf I didn't find answer to my second question:
2) Can iPhone act as a controller and issue all available commands stated in AVRCP 1.3 to target device (radio and CD player)?
I would also like to know about available frameworks for this particular problem. I know there are several of them, but if anyone recognizes the right one for my problem, I'd like to know:
3) Which framework for interacting with target device should I use?
From developer point of view, I am also interested in available APIs for interacting with connected Bluetooth device. Since I am making my own application and assigning actions to buttons, inside of methods assigned to buttons I need to perform message sending to target device. So my next question is:
4) Does anyone know how if there's a way to send commands to target device (start/stop/pause/forward/backward, etc) as part of some API provided in XCode, or each message which I attend to send via Bluetooth to target device I need to make according to protocol documentation (make entire message (header, body, command part, etc) by myself)?
AVRCP was my thought for accomplishing this application. If I am wrong, please let me know.
Bluetooth has different profiles and when message is sent from one device, as far as I understand, profile itself handles message and interprets it and delivers to target device so target device can understand it. I do not understand how a message sent from iPhone to target Bluetooth device is handled from the moment I send it from my Objective-C (or C) code. That's the main doubt I have and it is related with question 4 - do I need to make raw messages in correct format in order to send AVRCP commands to device or I can use some API which will recognize those messages as AVRCP (or any other kind) and deliver it to target device?
This last question (if I suppose there is any kind of positive answer to all previous) concerns me the most from developer point of view. So, if anyone had maybe experience with this specific problem, I would appreciate any kind of answer or advice.
I am really looking forward to your answers. I hope that constructive and useful discussion will start on this topic and that lots of useful informations will be written.
Best regards.
You can do it using CoreBluetooth if your device (CD Player) is Bluetooth 4.0 LE compliant
Most likely you shall not be able to do it even if your car CD player has BLE 4.0.
With Core Bluetooth devices act as "Central" (client) or "Peripheral" (server), the peripheral "has data" and expose services with characteristics (variables). The central (client) reads data from the peripheral or subscribe for notifications.
Your only chance is to connect to the CD player as peripheral (server) and your iPhone being the central (client). In this case the CD player must expose services that allow you to control it. To be honest I do not know how this can be done, since the central (the iPhone) will read data and receive notifications from the peripheral, not vice versa.
Reversing roles, implementing iPhone as peripheral makes sense, but there is no predefined Bluetooth LE service for remote control, so your car CD player does not know what service to expect from you. It might work using HID service (Human Interface Device), used in general for keyboards and mouse, but according to this post the HID is forbidden by Apple on iOS.

What can MFI enable?

I'm trying to determine what functionality I can add to a BT accessory by paying for the MFI authentication coprocessor. For example, could I...
A. Pass location data to the accessory?
B. Push incoming SMS messages to the accessory?
C. Launch my app on the phone from the accessory?
As Dennis mentioned, all information regarding the MFi program is covered under a VERY water tight NDA. However, what can be said is that all devices that connect to the iPad through Bluetooth or the docking connector port are accessed through the External Accessory framework. Documentation on the External Accessory framework is easily accessibly from Apple's documentation pages and can also be easily googled.
Communication with devices through the External Accessory framework is fairly simple once you've established a connection with a device. In short, the process is to find the desired connected accessory from an array of devices, establish a connection session and the session object contains a input and output stream. Data by creating a delegate that with the device and finally, monitor the associated input and output streams which you use to communicate with the device.
Again, the majority of the information associated with MFi is tightly sealed. However, as far as connecting to devices (that you have the right to connect to) is simple, well documented and is easily searchable since the framework is part of the standard, iOS library.
One other note on Bluetooth. There is also a Core Bluetooth framework that is available with iOS 5.0 and up. This is a much simpler framework that you can use to discover and auto pair with Bluetooth Low-Energy devices (which are part of the new Bluetooth 4.0 spec.)
If you are planning on making an iPad application or desire to have a fairly high level of backwards compatibility with earlier iOS devices, I wouldn't recommend using the new CoreBluetooth framework. The reason is because only the iPhone 4S and the soon to be released "New iPad" have the necessary Bluetooth chipset to connect with Bluetooth LE devices.
All Mfi information is under NDA.
It dosent cost anything to sign up and get access to the information , you can do it here.
https://developer.apple.com/programs/mfi/

iPhone Bluetooth Communication Examples

I've been trying to find examples on communicating with bluetooth devices on iOS and have been coming up short. As I understand it SPP is not yet supported. At the simplest level, I'd like to send a simple 1 or 0 signal to the bluetooth device I'm creating. (It's a bluetooth switch that would turn something on and off). Is there a way to cleverly do this through the HID or HFP profiles?
The short answer to your question is that you can't connect to an arbitrary Bluetooth device you may happen to have, you can only connect to a Bluetooth device that has come through Apple's licensing program (i.e. the "Made for iPod/iPhone" label). From Apple's documentation:
Q: [The External Accessory framework allows] my application to communicate with Bluetooth devices. So why doesn't my application see the Bluetooth accessory sitting next to my iPhone?
A: The External Accessory framework is designed to allow iOS applications to communicate only with hardware accessories that are developed under Apple's MFi licensee program.
So there is no public API for accessing an arbitrary Bluetooth device from within iOS: you have to go through the External Accessory Framework to communicate via Bluetooth, and the EAF's mission is "communicate with MFi devices," not "communicate with arbitrary external devices." A sufficiently ingenious developer could probably hack something in there, but -
it's a non-trivial undertaking
you are spectacularly unlikely to get past the App Store approval process
So there's just not much percentage in it - the effort of doing so is unlikely to reward you.
If there already exists an MFi device that can be coerced into doing something that you want, that's probably your best chance - short of going through the MFi approval/licensing process yourself, of course. If you want to do so, have at it and good luck.
I'm answering this question late because Zeroxide's answer is incorrect (you can use a random Bluetooth keyboard with your iOS device because Apple implemented that connection, which is different from giving you a public API path to doing likewise) and I find Rokridi's answer to be incomplete-though-headed-in-the-right-direction.
Edit: A caveat has since been added to the linked Apple page about Bluetooth Low-Energy devices. So there's a loophole, but it's not a big one because very, very few Bluetooth LE devices have actually been produced as yet.
As far as i know, if your external device is non iOs device then you should use External Accessory Framework to communicate your application with it. Threfore, you external device should be certified by Apple through the Made for Ipod program (MFI). Hope this helps.
If you want to use classic Bluetooth (not BLE), then you have to first PAIR the iOS device to the Bluetooth device (in Settings). If you can't do that then you can't communicate with it with your app.
NO. whether device is MFi certified or not, you can connect device to iphone if bluetooth profile is HFP, or HID's (ordinary profiles. not iAP profile). Think about bluetooth headset or keyboard. does it need MFi mark on it to use? NO. Never.

Sending data via bluetooth on Iphone (iOS 5.x)

I have been searching and searching, but found nothing yet. Is it really true that there isn't a straightforward way to establish a BT connection from my iPhone to another (3rd party) BT device, i.e. an audio receiver. I know this is possible through the OS (I own a Belkin BT music receiver that works this way - it appears in Settings and from there I can connect to it). Note that I am not interested in pairing to iOS-devices, but an iPhone and my custom made hardware.
I've managed to find Google's BTStack at code.google.com, iBlueNova, Celeste and more, which all must be run through Cydia or similar and also I stumbled upon Apple's MFI-program, which seems fairly complicated.
Does anyone have any experience with bluetooth and iOS, if so, how and where do I get started?
If one might be interested, the project I am developing involves a piece of hardware with a BT device attached on it. The app should be able to send simple commands via bluetooth (basically just ASCII characters) to the device, which will react depending on what it receives.
If you are developing accessories that need to connect to iOS devices and want to use your own communication mechanism then your only option is to join the Apple MFi program.