0

I was wondering if there was a way to programmatically put an iDevice to sleep, for my jailbreak tweak. I would also like to test if iphone is on too. Is there any way (public or private API) that could do this? Even simulating the press would be cool. I know activator cydia tweak can do this, just wondering how.

  • You want to put it to sleep (send notification to hardware that it should go into power saving mode) or you want to lock the screen (simulating lock button press)? It's completely different things. – creker Mar 17 '15 at 13:15
  • @creker I want to make it like u press the power button – Technical HAKRZ Mar 17 '15 at 23:43

1 Answers1

1

All methods from private SpringBoardServices.framework:

void* SBSSpringBoardServerPort();
void SBLockDevice(void*);

To lock device use this:

SBLockDevice(SBSSpringBoardServerPort());
creker
  • 9,400
  • 1
  • 30
  • 47
  • Where do I download this framework? Im confused because there are different ones all over the web. – Technical HAKRZ Mar 19 '15 at 01:29
  • You should read about private APIs. You should know how to use the code in my answer if you're working with jailbreak. – creker Mar 19 '15 at 08:27
  • Take a look at https://github.com/app111/powercode/blob/8ebd82f76d20e2b05a00697f487d249e3affd679/ios/BestPractice/BestPractice/SecondViewController.m – basvk Jan 12 '16 at 16:09