Hi,

I'm trying to lock the phone through my application .I'm using following
code

        PowerManager pm =
(PowerManager)context.getSystemService(Context.POWER_SERVICE);
        pm.goToSleep(160000);

I've added following permission to AndroiManifest.xml file

    <uses-permission android:name="android.permission.DEVICE_POWER"/>

But the application crashes by throwing following exception

*E/AndroidRuntime(  436): Caused by: java.lang.SecurityException: Neither
user 10032 nor current process has android.permission.DEVICE_POWER.*

Please help me to avoid the above mentioned exception or tell me some other
way to lock the screen

thanks,
shahzad

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to