According to a previous thread:
http://groups.google.com/group/android-developers/browse_thread/thread/94312b8093042beb/ae00cf5ad4d176e7?#ae00cf5ad4d176e7

The permission DEVICE_POWER is not available for applications.

On Feb 3, 6:46 pm, shahzad ahmad <shahzad.s.ah...@gmail.com> wrote:
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to