Reputation: 63
This is more of a general question although if you anyone has starting points (code wise) I'd appreciate it. This is my scenario. My app is launched and running in the background. The phone goes to sleep, is then woken up, unlocked and at this point I'd like the app to detect this. The challenges I see are as follows:
Input is appreciated. Thanks all
Upvotes: 1
Views: 818
Reputation: 740
First check the app background modes here:
Once the app is launched in the background for a period of time, and the device is secured with a passcode,
the UIApplicationDelegate method
- (void)applicationProtectedDataDidBecomeAvailable:(UIApplication *)application
will be called once the device is unlocked.
Upvotes: 1
Reputation: 100622
If you don't fit the list of apps permitted to run in the background then, no, you can't run in the background and expect your app to be permitted.
However, for academic interest: some sites alleged that Facebook hacked around the problem by claiming to be an audio provider and piping out silence.
I'm not aware of a means to detect phone locking and unlocking. You might be able to do something dodgy by checking out the precision of timers but that's pure speculation.
Upvotes: 0