在iOS 7的后台接收电池状态更改通知 [英] Receive Notification of Battery State Change While in Background for iOS 7

查看:112
本文介绍了在iOS 7的后台接收电池状态更改通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在为iOS 7构建一个应用程序,即使应用程序在后台,也需要在手机插入充电时自动显示警报。
该应用程序也考虑到位置,所以我想我可以保持它接收位置更新。但是,据我所知,该应用程序将在播放后台10分钟后停止接收有关电池状态的通知。
有没有关于我如何做到这一点的建议?我不需要在应用程序商店中发布应用程序。

So I'm building an app for iOS 7 which needs to display an alert automatically when the phone is plugged in to charge, even if the app is in the background. The app also takes location into account, so I guess I can keep it receiving location updates. However, as far as I know, the app will stop receiving notifications about the battery state 10 minutes after it is put in the background. Are there any suggestions as to how I can do this? I do not need to publish the app in the app store.

推荐答案

您可以启用后台获取,并定期检查电池状态那里。它并不像你要求的那么精确,但这是你得到的最好的。

You can enable background fetch, and periodically check the battery state there. It's not as precise as you require, but this is the best you will get.

这篇关于在iOS 7的后台接收电池状态更改通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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