iphone - 检测 iPhone 上的蓝牙接听/结束通话按钮

标签 iphone ios bluetooth mfi

是否可以检测并响应 iOS 上 HFP 蓝牙设备的接听/挂断按钮按下操作?有人见过这个吗?我应该在哪里寻找答案?我知道如果您注册设备制造商 (MFI) 计划,就可以访问较低级别的蓝牙,但我希望我不必深入研究。我也知道您可以响应 AVRCP 命令,但我不想使用此选项。谁能帮忙?

最佳答案

UIResponder 有一个 -remoteControlReceivedWithEvent: 方法,您可以使用它从外部设备(可能包括蓝牙耳机)接收事件。来自文档:

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.

目前尚不清楚耳机上的接听/结束按钮是否被认为等同于耳塞 Remote 上的播放/暂停按钮,但这可能值得一试。

关于iphone - 检测 iPhone 上的蓝牙接听/结束通话按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7210182/

相关文章:

android - Android上的蓝牙编程

iphone - 显然我不知道如何写一个setter

c# - 如何在 MonoTouch 中实现 IBOutlets?

ios - 无法在 iOS 7.1.1 sdk 上安装 iOS 应用程序

objective-c - 包含可访问方法的 iOS 类

蓝牙串行端口通信 (SPP)

iphone - 如何使用 Objective C 在 iPhone 中制作 .zip 文件?

iphone - UITextField 在输入时给出建议

ios - 将实时 FFT 设置传递给执行函数

ios - iOS 设备的后台蓝牙