Reputation: 29
I would like to detect the status of the iPhone, such as if the screen is off (screen locked), or if the device has sound turned off.
Can an API do this, or is there any other way can do it?
Thanks vikingosegundo for helping me to edit the article,but the above is not what i want to know. in my app, ijust want to check the device, i want to know if the iphone is sound off,and if the device is powered off(has no power). how can i know this ?
Upvotes: 2
Views: 2059
Reputation: 20197
When the user locks the screen, applicationWillResignActive
is called, and the app enters the "Inactive" state. Unless your app is running tasks that continue in that state (e.g. continuing to play audio) after about 20 seconds the phone will enter a sleep mode where your app is moved from inactive to its background state.
Upvotes: 5