iOS Private API: lock device and power off the screen

后端 未结 2 1886
灰色年华
灰色年华 2020-12-11 07:10

I\'m making an app for jailbreak that lock the device when the user launch the app. I\'ve tried GSEventLockDevice(); from GraphicsService

相关标签:
2条回答
  • 2020-12-11 07:46

    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).

    0 讨论(0)
  • 2020-12-11 08:02

    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.

    0 讨论(0)
提交回复
热议问题