iOS版可以收到Android这样的广播? [英] Can iOS receive broadcasts like Android?

查看:354
本文介绍了iOS版可以收到Android这样的广播?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的应用程序一段空闲时间足够长的时间后已被清理应用程序时,一个耳机/耳机是从的iOS 设备断开连接被告知起来(因此可能无法运行)类似于如何 广播接收器在android系统工作。我怀疑这是不可能的,但会AP preciate任何想法。

I would like my app to be informed when a headset/headphones is disconnected from an iOS device after a period of idle time long enough for the app to have been cleaned up (and thus might not be running) similar to how a BroadcastReceiver works in android. I suspect it's not possible but would appreciate any ideas.

我看着<一个href=\"https://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html\"相对=nofollow>本地和推送通知和<一个href=\"https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/Reference/Reference.html#//apple_ref/occ/cl/NSNotificationCenter\"相对=nofollow> NSNotificationCenter 。推送通知是不恰当的,因为事件在设备上发生的。它似乎只可能安排(通过指定时间)本地通知,而不是从系统事件和通知创建它们的 NSNotificationCenter 应用程序运行时只收到。

I have looked into local and push notifications and the NSNotificationCenter. Push notifications aren't appropriate because events happen on the device. It only seems possible to schedule (by specifying a time) local notifications and not create them from system events and notifications from the NSNotificationCenter are only received when the app is running.

有我misinter preTED上述任何信息或有另一种伎俩使用?

Have I misinterpreted any of the information above or is there another trick to use?

推荐答案

后台进程和基于系统事件的广播接收器不运行是不可能在目前的版本(iOS 6中)的应用程序以及任何previous版本。有没有计划使人们有可能,我所遇到的。

Background processes and system event based broadcast receivers for an application that isn't running aren't possible in the current version (iOS 6) and any previous versions. There are no plans to make it possible that I have come across.

正如在问题指出,有可能使用<一href=\"https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/Reference/Reference.html#//apple_ref/occ/cl/NSNotificationCenter\"相对=nofollow> NSNotificationCenter 来实现类似的影响,但只有当触发事件的通知是外部到手机或通知可以从$被触发p $ pdetermined时间。

As stated in the question, it is possible to use the NSNotificationCenter to achieve a similar affect but only if events that trigger the notifications are external to the phone or the notifications can be triggered from predetermined time.

这篇关于iOS版可以收到Android这样的广播?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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