我可以在后台通过蓝牙发现其他 iOS 设备吗?
我希望能够在我的应用程序处于后台时通过蓝牙发现其他 iOS 设备。当我的应用程序不在前台时,是否可以使用 Bonjour 或 Game Kit 来进行此发现?
如果发现兼容设备,是否可以执行此操作并发出通知?
另外,我可以在播放音频时在后台运行并进行此检测吗?
I would like to be able to discover other iOS devices over Bluetooth while my application is in the background. Is it possible to use Bonjour or Game Kit to do this discovery while my application is not in the foreground?
Would it be possible to do this and fire off a notification if a compatible device is discovered?
Also, would I be able to run in the background while playing audio and do this detection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您的申请被暂停时,这是不可能的。来自 iOS 应用程序编程指南:
但是,如果您的应用程序正在传输音频,则有必要维持网络连接,因此您应该能够在后台连续播放音频的应用程序中进行 Bonjour 发现。确保您不会通过循环播放无声音频剪辑来滥用此功能,这样您就可以留在后台,否则您的申请将被拒绝。
This is not possible while your application is suspended. From the iOS Application Programming Guide:
However, if your application is streaming audio, it would be necessary for it to maintain network connections, so you should be able to do Bonjour discovery while in the background for an application continuously playing audio. Make sure you don't abuse this by playing a silent audio clip in a loop just so that you can stay in the background, or your application will be rejected.