LE SANG
LE SANG

Reputation: 11005

Can we recognizer gestures when iOS in lock screen mode?

I can detect Lock screen mode in my App like that:

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    UIApplicationState state = [application applicationState];
    switch (state) {
        case UIApplicationStateInactive:
            NSLog(@"LockScreen");
            [self.viewController addGestureRecognizersToView:self.viewController.view];
            break;

        case UIApplicationStateBackground:
            NSLog(@"Background");
            break;
        default:
            break;
    }
}

I want to continue recognizing gestures(tap,longPress...) but don't need to slide to unlock. Is it possible? Which option to control it?

Upvotes: 0

Views: 203

Answers (2)

sunkehappy
sunkehappy

Reputation: 9101

It's impossible. If the device is locked. App can almost do nothing for the event handling(except for the remote control event). Because the device will not handle these events. And this is indeed the correct case. If the device still handling the events it will cost a lot of battery energy.

Upvotes: 1

user149341
user149341

Reputation:

No, it's not possible. Your application does not receive gesture input while it is not visible (for instance, when the lock screen is up).

Upvotes: 2

Related Questions