auto-lock

auto-lock iphone/ipad programmatically

自作多情 提交于 2019-12-23 19:42:59
问题 Is there a way to 'force' the user to have auto-lock (and maybe passcode lock) on while the application is running (for security reasons mainly)? If we can't set them programmatically, can we at least check to see if they are set? Thanks, Mihai 回答1: if ([UIApplication sharedApplication].idleTimerDisabled == YES) { UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Please enable auto-lock"...]; [alert show]; [alert release]; } else { /* some code */ } The above snippet will check to see

How can I prevent iPhone (including iOS 7) from going to sleep in HTML or JS?

百般思念 提交于 2019-12-12 07:09:35
问题 I'm attempting to write some code to keep a phone alive and not go to sleep on a webpage. In my search, I found this post: Prevent iOS mobile safari from going idle / auto-locking / sleeping? But looping an audio file seems to no longer keep MobileSafari alive and prevent the phone from locking. While forcing the page to refresh every 30 seconds works, I need the original page to stay open. Google's latest interactive music video, Just A Reflektor, seems to be preventing lock from mobile, and

Auto Lock iPhone programmatically

馋奶兔 提交于 2019-12-08 04:05:23
问题 I am working on an alarm app, which needs to auto-lock the device after a particular time period, since most of the clock applications in the App Store have that feature. 回答1: If you would like to lock the phone after 5 minutes then do the following: set this: [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; and also set a timer: [NSTimer scheduledTimerWithTimeInterval:240 target:self selector:@selector(disableIdleTimer) userInfo:nil repeats:NO]; And in the disableIdleTimer

Auto Lock iPhone programmatically

孤人 提交于 2019-12-06 16:10:54
I am working on an alarm app, which needs to auto-lock the device after a particular time period, since most of the clock applications in the App Store have that feature. If you would like to lock the phone after 5 minutes then do the following: set this: [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; and also set a timer: [NSTimer scheduledTimerWithTimeInterval:240 target:self selector:@selector(disableIdleTimer) userInfo:nil repeats:NO]; And in the disableIdleTimer method you will set this: [[UIApplication sharedApplication] setIdleTimerDisabled:NO]; This will work with the

How can I prevent iPhone (including iOS 7) from going to sleep in HTML or JS?

痞子三分冷 提交于 2019-11-30 02:33:28
I'm attempting to write some code to keep a phone alive and not go to sleep on a webpage. In my search, I found this post: Prevent iOS mobile safari from going idle / auto-locking / sleeping? But looping an audio file seems to no longer keep MobileSafari alive and prevent the phone from locking. While forcing the page to refresh every 30 seconds works, I need the original page to stay open. Google's latest interactive music video, Just A Reflektor , seems to be preventing lock from mobile, and their JS here references a preventSleepIos function. What could I simply do to prevent iOS from

Allow “auto lock” while video is being played

微笑、不失礼 提交于 2019-11-28 09:32:19
No matter whether I am using MPMoviePlayerController or AVPlayer ( AVFoundation ), the iOS does not allow the device to auto lock (to enter sleep mode ) while the video is playing. I have a case where an extremely slow video is constantly being played in a loop in the background. While this video is playing, the device never goes to sleep. So far, the only option I have is to detect when a user did not make any actions for a while and then pause the video. After that, the device counts down the "auto lock" duration that is specified in iOS Settings. I am looking for an alternative to AVPlayer

Make the iPhone Screen Dim

故事扮演 提交于 2019-11-27 22:55:16
I have managed to ensure that the iPhone doesn't auto-lock using: [[ UIApplication sharedApplication ] setIdleTimerDisabled: YES ]; But how do I make the screen dim after a certain amount of time? Thanks... EDIT: Think I've found a solution myself: Use this method in your view controller to dim by adding a black view with 50% alpha. Make sure to set userInteractionEnabled = NO to pass events to underlying views. - (IBAction)dim:(id)sender { UIView *dimView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)]; dimView.backgroundColor = [UIColor blackColor]; dimView.alpha = 0.5f; dimView

Allow “auto lock” while video is being played

混江龙づ霸主 提交于 2019-11-27 02:27:59
问题 No matter whether I am using MPMoviePlayerController or AVPlayer ( AVFoundation ), the iOS does not allow the device to auto lock (to enter sleep mode ) while the video is playing. I have a case where an extremely slow video is constantly being played in a loop in the background. While this video is playing, the device never goes to sleep. So far, the only option I have is to detect when a user did not make any actions for a while and then pause the video. After that, the device counts down