tags:

views:

1749

answers:

6

Hello Everyone. Hope you all are fine and of course are in your best of mood today.

one question Ping my mind everyday I start my work with SDK and iPhone.

Question is....

"How do i Programmatically lock and unlock main screen of an iPhone" mean by i want to Lock and unlock device not an application.

since i newbie in iPhone, i don't know how its Possible.

so kindly help me to find its solution.

Sorry for my wrong english if u found And Thanks for your Support.

A: 

I don't believe that there is a way to achieve this.

One thing that i believe is possible is to stop the IPhone from locking. you could then build a view that copied the lock unlock function and you would still have control over the phone.

Bluephlame
+9  A: 

It's not possible. However, you can "prevent" your phone from locking when your app is running. [UIApplication sharedApplication].idleTimerDisabled = YES should do it.

Mugunth Kumar
A: 

if so, if the user presses the exit button the application will be automatically exited. so what needs to be done in those cases.

Mohammed Sadiq
A: 

May be you can try playing with this'


[[ UIApplication sharedApplication ] setIdleTimerDisabled: YES ]
AJ
A: 

how come this is impossible to unlock the device? i mean if Apple has done this , then how come is it not possible?

There is some way to lock and unlock iphone but how to do it???

maddy
There's no technical reason why it couldn't be done. It's not provided to applications because allowing 3rd-party applications to lock and unlock the screen would likely degrade the user experience.
Andrew Medico
ok, i agree with you that it can interact with OS kernel so that could be a reason that Apple didnt allowed it but that doesnt mean that it is impossible, i mean with a jailbroken iphone .. i can do it!i just want to a tip or pointer how to do this even if not allowed by Apple. how to unlock iphone programmitically?
maddy
A: 

it basically isn't possible because this probably is part of the private frameworks which can be used by Apple only. There are apps such as the fake caller apps that utilize a "fake" lockscreen but as you've pointed out, pressing the home button quits the app, rendering your lock screen useless.

David Schiefer