ios - 如何在 iOS 应用程序中获取蓝牙配置文件状态
问题描述
当 iOS 设备与远程蓝牙设备连接时,我想在我的应用程序中获取蓝牙配置文件,即 ACL、耳机等状态。我找不到与它相关的任何东西。
谁能帮我实现这一目标?
解决方案
我认为您正在搜索的是 MPVolumeView。检查它 - https://developer.apple.com/documentation/mediaplayer/mpvolumeview
更新- 您可以观察音频路由更改 AVAudioSessionRouteChangeNotification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioRouteChanged:) name:AVAudioSessionRouteChangeNotification object:nil];
您还可以从以下位置获取音频路由 -
for( AVAudioSessionPortDescription *portDescription in route.outputs )
{
headphonesLocated |= ( [portDescription.portType
isEqualToString:AVAudioSessionPortHeadphones] );
}
推荐阅读
- python - 使用 python 和 selenium webdriver 抓取样式显示设置为 none 的元素
- azure - Azure APIM 从后端服务导入所有操作
- c# - 为什么要将 (GameObject) 放在实例化之前?
- javascript - Promise.all() 用于一组等待函数
- c# - 如何在 Unity 的更新方法中保持相同的值
- python - 如何在 simulink 中使用 python 返回 numpy.array
- android - Android 应用程序中的 Paytm 钱包集成卡在处理中
- django - 如何在公司内部启动我的 Django 应用程序?
- akka - janus-gateway: java.lang.IllegalStateException: 子流源不能多次实现
- javascript - 是否可以在第二次单击按钮时运行 PHP 代码,而不是在第一次单击时立即运行?