How can you tell sleep vs. home on iOS?
Hello,
We are authoring an iOS app where we want to have different behaviors on reactivation (Event.ACTIVATE), based on whether the user let the iPad go to sleep, or if they pressed the Home button to exit the app. Basically, a user's action affects the length of time before we make them log back in. We have UIApplicationExitsOnSuspend set to false.
However, we haven't found a way of distinguishing between sleep or home button pressed. We've been experimenting with different properties and events in the NativeApplication class. Here's what we've found so far:
- Event.DEACTIVATE is triggered by both sleep and home button
- Event.EXITING is not triggered by either, presumably because UIApplicationExitsOnSuspend is false and thus app is not exiting.
- Event.SUSPEND is not triggered by either (maybe not supported on mobile?)
- Event.USER_IDLE is not supported on mobile devices.
We also tried faking a sleep event, under the theory that most users will not change the default Sleep setting of 2 minutes, by checking timeSinceLastUserInput, only to find that property is also not supported on mobile devices.
Has anyone else tried to distinguish between sleep or home button pressed? Any suggestions on other things to try?
TIA,
--Chi-An
