简体   繁体   English

后台iOS应用程序是否收到显示器将要睡眠的通知?

[英]Does a background iOS app receive notification that the display is going to sleep?

My specific requirement is an app that is in the background, being notified that the display is about to go to sleep or that the device has or is about to reach it's idle timeout - and then waking up and executing some (brief) piece of code. 我的具体要求是一个处于后台的应用程序,通知显示器即将进入休眠状态,或者设备已经或即将达到空闲超时 - 然后唤醒并执行一些(简短的)代码。

I have found reference to notifications that an app is being put in the background or suspended here: http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html 我发现有关应用程序被置于后台或暂停的通知的引用: http//developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html

And there seems to be a way of detecting on OSX: http://developer.apple.com/library/mac/#qa/qa1340/_index.html 似乎有一种在OSX上检测的方法: http//developer.apple.com/library/mac/#qa/qa1340/_index.html

So, can a background iOS app receive notification that the display is going to sleep and execute just before it does? 那么,后台iOS应用程序是否可以接收显示器将要睡眠并在其执行之前执行的通知?

No, thats not possible on iOS. 不,这在iOS上是不可能的。 I suggest you file a bug report at bugreport.apple.com and explain to them why you need such a feature, although this isn't a guarantee that such a thing will come. 我建议你在bugreport.apple.com上提交一份错误报告并向他们解释你为什么需要这样一个功能,虽然这不能保证这样的事情会发生。 But if more people request this feature, the likelier it gets implemented. 但如果有更多人要求使用此功能,则可能会实现此功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM