Bluetooth answer / end call detection button on iPhone

Is it possible to detect and respond to pressing the answer / end buttons from an HFP Bluetooth device on iOS? Has anyone seen this? Where to look for answers? I understand that you can access a lower level of bluetooth if you sign up for a device manufacturer program (MFI), but I hope I don’t need to dive deep. I also know that you can respond to AVRCP commands, but I do not want to use this option. Can anyone help?

+4
source share
3 answers

The UIResponder has a -remoteControlReceivedWithEvent: method, which you can use to receive events from external devices, possibly including Bluetooth headsets. From the docs:

Remote control events occur in the form of commands from external accessories, including headsets. The application responds to these commands by controlling the audio or video content presented to the user. The receiving responder object must examine the event subtype to determine the intended command, for example play (UIEventSubtypeRemoteControlPlay), and then act accordingly.

To ensure the delivery of remote control events, you must call the beginReceivingRemoteControlEvents method for UIApplication; to disable remote control event delivery, call endReceivingRemoteControlEvents.

It is unclear whether the answer / end button on the headset is equivalent to a play / pause button, such as a headphone console, but it might be worth a try.

+3
source

Unfortunately, there are no bluetooth public APIs available for developers, so there is no way to get this access by conventional means.

0
source

According to my research, someone received some kind of event from their bleu-tooth devices via "remoteControlReceivedWithEvent", but not all of them! Some don't get a single one! And very few get them all!

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

In addition, some messages suggest that instead of "Low Energy" you can use the "classic shine": How to use the bluetooth classic instead of le But it has a limitation (the post is "MFi accessory"! MFi is "made for iphone"?!? !?!)

from the post above: β€œA Bluetooth device other than LE must be approved by MFi for use with the infrastructure of an external accessory (for this you need to use a specific Apple chip and a proprietary communication protocol). You cannot create applications to access this device if it is not uses the more open Bluetooth LE or doesn't use this chip for standard Bluetooth. There may be ways to do this via jailbreak, but almost everyone I know has switched to Bluetooth LE. "

more post: Connect to a Bluetooth device with iOS, without MFi

Sincerely.

0
source

Source: https://habr.com/ru/post/1369230/


All Articles