Reputation: 10599
I'm developing an application for Android 1.6 and newer which contains a functionality that switches the phone to sleep.
I tried to find a way of how to do that and I found the goToSleep method in the PowerManager class, but unfortunately the usage of that method requires android.permission.DEVICE_POWER permission which is a system level permission allowed only for system apps only.
Does anybody know an alternative way of forcing the phone to go into sleep mode or how to sign an application to gain the above mentioned permission and to allow the usage of the goToSleep method? Thank you!
Upvotes: 2
Views: 2228
Reputation: 1006724
I'm developing an application for Android 1.6 and newer which contains a functionality that switches the phone to sleep.
AFAIK, that is not supported by the Android SDK for ordinary apps.
or how to sign an application to gain the above mentioned permission and to allow the usage of the goToSleep method?
That requires you to compile and install your own firmware.
Upvotes: 5