检测在iPhone蓝牙接听/结束通话按钮 [英] Detect Bluetooth answer/end-call button on iPhone

查看:329
本文介绍了检测在iPhone蓝牙接听/结束通话按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以检测并从iOS上的HFP蓝牙设备的接听/结束通话按钮presses回应?有没有人见过这个?我应该在哪里寻找答案?我明白,如果你注册设备制造商(MFI)计划人能拿获得较低水平的蓝牙,但我希望我没有潜水这个深。我也知道,你可以到AVRCP响应命令,但我不想使用此选项。谁能帮助?

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有一个 -remoteControlReceivedWithEvent:你可以用它来接收来自外部设备的事件,可能包括方法蓝牙耳机。从文档:

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

远程控制事件起源来自外部配件,包括耳机的命令。应用程序通过控制psented用户音频或视频媒体$ P $响应这些命令。接收响应对象应检查事件的子类型来确定预期的命令 - 例如,播放(UIEventSubtypeRemoteControlPlay) - 然后执行相应的操作。

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.

要允许远程控制事件的传递,必须调用的UIApplication的beginReceivingRemoteControlEvents方法;关闭远程控制的事件,呼吁endReceivingRemoteControlEvents的交付。

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.

这篇关于检测在iPhone蓝牙接听/结束通话按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆