简体   繁体   中英

How to have your app notified whenever iPhone is turned on or will be turned off?

Is there any way my app can be notified (even if it's not in use or background) whenever the user turns his iPhone on and a few moments before it is turned off? Thank you since now. This is needed in order to know how much time has the phone been off.

I haven't tried it, and it's obviously hard to debug to find out what is happening. It would make sense that your app is moved to the background. If it is in the background, it shouldn't really matter whether the phone is turned on or off.

You can look at file encryption; if the user uses a passcode then you will be notified when encrypted files cannot be accessed anymore, and when they can again be accessed. That will happen when the phone is turned off or on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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