Make use of external hardware Music controls in my custom App - iphone

I'm looking for a way to detect the buttons pressed of external music control buttons, I have integrated in my car via bluetooth. Is it possible to make use of them in my App for something else that playing and stoping music?
Thanks a lot!
Markus

Those controls are probably talking to your iPhone using the remote control lingo, part of iAP (iPod Accessory Protocol). For documentation on this, you need to join Apple's MFi program, which is a separate account to a normal developer account and quite a bit more difficult to get approved for.
I'm not certain whether it's possible to get your application to talk to those devices, as you need to specifically enable application communication on the device itself and there's an authentication scheme you need to handle.

Related

How does apple approve the app that controls external multimedia player without having it?

I am just wondering how does apple approve the iPhone app that communicates via WiFi network with external multimedia player device that is controlled by this app?
Actually, this app is remote control for multimedia player such as smart tv
How would I submit this to apple?
Does anyone know how to submit app that controls multimedia player to register app store?
Thanks in advance.
Good question. Kind of a gray teritory here.
We have an app in App Store that acts as a dashboard for boat (gathering data from wifi device).
Since it's wifi it doesn't need (nor can it get) MFi approval (as is probably the case with your device).
App passed the approval process. We did have to submit some additional information about the application. The main issue is: all functions of the application have to be visible to the reviewers, even if they don't function without the external device.
How to achieve that depends on you device GUI. You could implement a kind of demo functionality.

Detect Bluetooth answer/end-call button on iPhone

Is it possible to detect and respond to the answer/end-call button presses from an HFP Bluetooth device on iOS? Has anyone seen this? Where should I look for answers? I understand one could get access to lower level bluetooth if you register for the device manufacturer (MFI) program but I'm hoping I don't have to dive this deep. I also know that you can respond to AVRCP commands but I am not wanting to use this option. Can anyone help?
UIResponder has a -remoteControlReceivedWithEvent: method that you can use to receive events from external devices, possibly including Bluetooth headsets. From the docs:
Remote-control events originate as commands from external accessories, including headsets. An application responds to these commands by controlling audio or video media presented to the user. The receiving responder object should examine the subtype of event to determine the intended command—for example, play (UIEventSubtypeRemoteControlPlay)—and then proceed accordingly.
To allow delivery of remote-control events, you must call the beginReceivingRemoteControlEvents method of UIApplication; to turn off delivery of remote-control events, call endReceivingRemoteControlEvents.
It’s not clear whether the answer/end button on a headset is considered equivalent to the play/pause button on, say, the earbuds’ remote, but this might be worth a try.
Sadly, there are no available bluetooth public APIs for developers, so no way to get that access in the conventional means.
As of my research, some person received some event from their bleu-tooth devices via "remoteControlReceivedWithEvent" but not all of them! Some are receiving none! And very few are receiving all of them!
I also tried Core Bluetooth but it only supports LEB (Low Energy Bluetooth devices)!
https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothOverview/CoreBluetoothOverview.html#//apple_ref/doc/uid/TP40013257-CH2-SW1
Also, some posts suggest it is possible to use Classic bleutooth instead of "Low Energy":
How to use bluetooth classic instead of le
But it has limitation as well (the post is taking about "MFi accessory"! MFi is it for "made for iphone" ?!?!?!)
from the post above:
"A non-LE Bluetooth device needs to be MFi-approved to be used with the External Accessory framework (it needs to use a specific Apple chip and a proprietary communication protocol). You won't be able to build applications to access this device unless it either uses the more open Bluetooth LE or has this chip in it for standard Bluetooth. There might be ways to do this via jailbreak, but pretty much everyone I know has moved over to Bluetooth LE." !
more post: Connecting to a Bluetooth device from iOS, no MFi
Regards.

Use external clickwheel hardware in iOs app

Intro: I have a Denon S-52 internet radio with an iPod/iPhone dock (the older 12V kind, so charging is not possible with newer devices but audio/control data is passed through). The radio has an external clickwheel-like control that worked beautifully with iPod nano/classic etc. Since the iPhone/iPod touch no longer have any clickwheel functionality, the signals from the Denon clickwheel no longer have any effect while playing (ie no seeking), but can navigate through some menus on iOS, and play/pause works. The few clickwheel apps I've tried obviously ignore the external signals.
Questions: How hard would it be for someone with no iOs programming experience (just C/C++/C#, plus an objective C tutorial from lynda.com) to develop a basic audio player app that would accept signals from the external Denon clickwheel to seek within an audio file (for my own use, at least at first)? I'm assuming this is possible because the signals are sometimes processed (as mentioned above), but I'd be happy to be proven wrong before I waste a lot of time and effort. I also assume a standard $99 iOS developer membership would be enough (since the device itself is already MFi)? Or perhaps an app that has this feature already exists?
How hard would it be for someone with no iOs programming experience (just C/C++/C#, plus an objective C tutorial from lynda.com) to develop a basic audio player app that would accept signals from the external Denon clickwheel to seek within an audio file (for my own use, at least at first)?
Nearly impossible. It's not just the challenge of figuring out how to access the dock connector and interpret the signals of interest. The real problem is that you want to use those signals to control music that's playing, and you're probably thinking of trying to control the iPod application rather than writing your own music player. Communicating between two apps is difficult at best, and probably not possible if the target app (iPod) doesn't provide a mechanism for external control. And the fact that you're new to the platform doesn't make any of this easier.
Your best hope is probably to file a bug with Apple requesting this feature and hope that they'll add it for you.
I was able to do this by jailbreaking my iOS device, which enabled me to access the serial port for iPod Access Protocol communication at /dev/tty.iap. Then I could incorporate something like the functions found in this iPhone Serial Port Tutorial (check archive.org if the link no longer works) to read the incoming signals and respond accordingly.
Update: An even better solution seems to be to write a tweak hooking into the iPodUI private framework and intercept the commands directly, and then message the Music player about what to do (see this post for more details).

Is there iPhone authentication by MFI external accessories?

I am doing preliminary design of an iPhone app and I'm trying to find the answer to the following question: Does the MFI system allow an external accessory to restrict which particular iPhones are plugged into it?
I presume that I can add something to the external accessory protocol to do authentication/authorization. My question is, do I have to bother--does the MFI system already provide that?
I'm led to believe that if I register with the MFI program, I can get the answer, but I do not intend to ever do so. I will eventually work with a developer that is an MFI registeree. I suppose I could wait until I've established a relationship with such a developer and then ask them to find out, but I was hoping to get an answer to this one specific question prior to that point.
I'm hoping that as I am just looking for user level info, and not implementation details, that the answer is not hidden behind the MFI NDA.
Thanks.
Does the MFI system allow an external accessory to restrict which particular iPhones are plugged into it?
This is handled in the following manner:
The App must initiate a session using a protocol that the Accessory supports.
The App must know how to talk to the Accessory (i.e. how to encode/decode communication data).
There is nothing preventing any random iOS Device with the proper App installed from connecting to an External Accessory so long as the App meets the above requirements.
The External Accessory could implement some additional form of security (like sending a password maybe?) before opening up its full capabilities to the App. Obviously, this would require the Accessory developer and App developer to both know this extra procedure.

What's needed to use the Apple Accessory Protocol?

I'm in the process of planning out a personal project that will be a media player and one of the things I would like to do is be able to dock my iPod touch (or any iPod or iPhone) and control it and play music off it like the speaker docs do that you can buy.
I found some information while searching around online for this but my question is can I make up a cable and use the serial protocol from any device or does Apple have this locked down so only certified/approved devices can communicate this way?
If you are looking to do this for yourself, I would recommend jailbreaking and the following resources on the web. These describe some methods of the Apple Accessory Protocol, and include some parts (at sparkfun) to execute. To get approved for the Apple method you need a corporation (or similar structure) and even legal counsel before you can get approved to even see the agreement you have to agree to in order to join.
http://nuxx.net/wiki/Apple_Accessory_Protocol
http://www.sparkfun.com/categories/101
There are even some great articles out there such as:
http://courses.cit.cornell.edu/ee476/FinalProjects/s2007/awr8_asl45/awr8_asl45/index.html
Good luck!
EDIT:
Since this is a relatively popular post, keep in mind that you can now use Bluetooth 4.0 LE for serial communication without approval from Apple (other than AppStore approval).
https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/AboutCoreBluetooth/Introduction.html
Only devices in the Made for iPod program which use Apple's proprietary authentication chip can communicate with the External Accessory framework on the iPhone or iPod touch. Such devices must also expose a protocol that iPhone applications can use.
It is a reasonably involved process to be approved as a Made for iPod vendor of products (similar to the App Store approval process, but for hardware), but it has become a lot easier than it used to be. With iPhone OS 3.0, Apple has opened up the program to many more third parties than just the usual large accessory providers.
In your case, I'd actually wait and use another vendor's iPhone-controllable stereo. Manufacturers are just starting to come out with hardware controllable via iPhone applications, so it's only a matter of time before one of the larger accessory providers creates something like what you want. If they expose a protocol for controlling the device, all you'll have to do is write your application to control the device via that protocol.