iOS Private API: lock device and power off the screen - ios

I'm making an app for jailbreak that lock the device when the user launch the app. I've tried GSEventLockDevice(); from GraphicsServices.framework but this does not work properly because it locks the screen but does not power off the screen. Is there another way to lock the screen without MobileSubstrate?

Just as another alternative, check out this answer, which uses SBDimScreen(). You could use that in conjunction with GSEventLockDevice().
It appears that you may now (iOS 5+) need to add an entitlement to your app to use this call successfully. If you haven't done that before, here is an example of how to do so. Obviously, in this case, the entitlement in question must be changed to com.apple.backboard.client.
You also might see if #VictorRonin has experimented with this, as he commented on the question I linked to. I tested SBDimScreen() on a jailbroken iOS 4.2.1 device, but my newer devices are currently unavailable to run this test. I'll try it later on iOS 5.x and post an update.
Note: the answer I linked to from Elias has a different call altogether for iOS 6.

Look at these several questions:
Simulating System Wide Touch Events on iOS
Simulating System Wide Touch Events in iOS without jailbreaking the device
How to send a touch event to iPhone OS?
The idea is that you can simulate system wide events. One of events is power down event. If you simulate it, it will turn off device and will lock it.
BTW. You may be interested to google more on GSEvent which is the key for even simulation.
Here are couple of useful links:
http://iphonedevwiki.net/index.php/GSEvent
http://networkpx.blogspot.com/2009/08/gsevent-recording-and-playback-in-30.html
Also, this approach isn't limited to jailbroken phones. It works on jailed phone too (however, you won't be able to post it to AppStore).

Related

Can we lock a phone with iOS programatically?

I need to set a timer to lock an iPhone from my app. While using the application, after 3 to 5 minutes the phone should become locked.
Short answer: You can't.
Long Answer: For the security of iOS users, Apple does not allow any application to work with important hardware matters, such as locking the iPhone or controlling the usage of other apps. If your app even attempts to do such a thing (using any method, like external APIs), your app will immediately be rejected by Apple. It is not even worth trying.
You cannot lock the screen programmatically without any private API. Even if you use a private API, your app may probably be rejected by App Store.
However you can indeed achieve by sending keyboard events from paired bluetooth hardware devices. But that means your code depends on a Bluetooth connection and I cannot think of any practice use of that. To do this with Bluetooth, click here.

Lock iPhone and iPad Screen programmatically

I want to lock screen iPhone and iPad programmatically
I have searched a lot but didn't get proper idea. I have found one app Lock me but it is not worked on after iOS 7.
here is that link
https://github.com/neuroo/LockMeNow
as per my search I think we are able to implement this functionality using private api and using kiosk mode.
I don't think you can programmatically lock the iPhone or iPad from you application. that not full fit the apple policy and its guide line. In iOS app development we can not handle any API that out of the application. Apple not make any API for lock screen that you fire from your native app.
Other things is you are attached one link in your question. that clearly write the limitation that:
This application can obviously not be accepted (as is) on the Apple Store, and that's mostly why I put it here. If you want to use the application, you will need a developer cert (or a jailbroken device and using the iDevice build toolchain).

views, methods and function of ios device from bash

I'm doing a research for my thesis and I would like to know how I can access to the views methods or functions of the user interface(like Android View Client for Android devices) of a ios device from bash without touching the device connected. The reason is that I want to create a self-test for an app and then I would do things like touches or gestures via software. How could i do? Can you give me some guidelines?
must work for devices without jailbreak
Sorry for the bad english.
This is not practical / possible. Instead, you should look into UIAutomation. You can use javascript to simulate all interactions with an app on either actual hardware or in the simulator.

Bluetooth Low Energy Emulate Keypress

I am playing around with a TI CC2541 chip, and was wondering if it is possible to send a "keypress" over BLE. This would be similar to the new Muku Shutter for iOS and Android, because I am trying to figure out a way to interface with a mobile device without installing a 3rd party application. Essentially, I would press the button on the CC2541 chip, and then it would emulate a keypress of volume up?
I have been researching for a while now, and all solutions to handle this have included writing a 3rd party application to map the commands in the BLE packet to a system command.
Any help would greatly be appreciated. Thank you!
On iOS the answer is no
Edit:
Exception: You might be able to set up your BT chip as a Bluetooth keyboard.
You could certainly write an app that talks with a remote BLE device and uses an agreed-upon protocol to pass key presses to your app, and then you could interpret those messages using code in your app.
However, Apple enforces a "sandbox" on its apps, and apps are not allowed to interact directly with the system except through very tightly controlled set of APIs. If there is not an official interfere to do something, it is not allowed.
If you were to run on a jailbroken device then the answer would likely be different. I can't help you there however.
Edit:
#OliverMason says in a comment that iOS shutter buttons are apparently single-key BlueTooth keyboards that emulate the volume up button, which the camera app recognizes as a way to trigger a photo. Thus my answer above isn't quite accurate.

Controlling iOS device

Is it possible from my app to run in background, turn on/off other apps, control the iOS device without jailbreaking it? I understand that this app will not pass Apple's review/approval, but I am not planning it, instead, I just need to distribute it to clearly defined list of devices. I just prefer not to require to jailbreak device.. Is it possible?
I believe its possible without actually jailbreaking the physical device. Check out the second answer to this question for some more information. iOS app without developer program or jailbreak

Resources