Programmatically lock and unlock iPhone (not jailbroken) screen? - ios

Can we programmatically lock and unlock Screen of the iPhone?
Heard of GSEventLockDevice() (private API) from GraphicsServices.framework but is not working in higher iOS versions.
Please checkout the following video:
https://vimeo.com/188356953
Don't know how the iPhone screen is getting locked programatically in Cellcontrol !
Any ideas are welcomed !

We can't lock the screen programmatically without any private API but your requirement can achieve by sending keyboard events from paired bluetooth hardware devices.
Please check this link Force lock screen

There is no documentation given by Apple to do it.
But there are some private API's which can be possible to do it but it is not accepted by Apple when you submit your app to AppStore.
So be specific on it whether you are going to submit in AppStore or Private purpose.
But you can keep your device unlock from auto lock by using the below line.
[UIApplication sharedApplication].idleTimerDisabled = YES;

Related

iOS - Show View when phone is locked

I'm building an ios app with an alarm feature. I would like to show a view when phone is locked. I want to look exactly like on iOS alarm. If you're an iPhone user try to alarm and locked your phone you will get what i'm talking about. Is it possible? If possible how?
Thanks in advance.
iOS doesn't provide apps that kind of access to the lock screen (or any screen not in your app), so it's impossible to make it exactly like the iOS native alarm. The closest you can get is sending notifications to simulate an alarm, which are visible on the lock screen

How to determine number of locks and unlocks of iPhone programmatically

is it possible to determine how many times my iPhone has been locked and unlocked programmatically when app is foreground and background as well. Code snippet will help a lot...
There's no way to get this information from your App.
You can only know when your app goes to foreground/background via your App Delegate, but not what the user does outside of your App.

Put Mobile App Launch Icon on Notifications Screen to Launch from Locked Device

Want to put the icon for our iOS app on the iOS Notifications Screen that can be accessed when a user has not entered their passcode, so that the user can launch the app when the phone is locked without needing to input their passcode. The goal is for a very fast launch with minimum time from a locked iphone. We don't need to actually send the user a notification. Would also be great for this to work on Android, but iOS is currently more important for this feature.
What is the best way to do this using Cordova? Is there an existing plugin for this purpose?
Thanks
It is not possible to launch an iOS app without unlocking the phone/device. The notifications screen is only available once the iOS device is unlocked.
(thanks to dan)

IPhone state from sound mode to silent/vibrate mode

I want to develop an iOS app which on button tapped the phone state from sound mode to silent/vibrate mode . how to do it??
There is no official/legal/acceptable by Apple way to accomplish what you want. However, if you are still interested you should check private libraries for the app for jailbroken devices.

iOS Phonegap: disable auto-lock but allow turning off the screen

I'm working with Phonegap and I'm trying to disable the auto-lock, but allow in the meantime the phone to turn off the screen. So the phone is not locked, but the screen appears off. This is in order to save battery and allow my application to continue its work.
Can this be achieved? Thanks.
Fairly certain that is not possible, even with the official Apple SDK.

Resources