I need to power off device by button on my application. I add permission to manifest file:
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="13" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.DEVICE_POWER"/>
And use powerOff method on click button:
void powerOff(){
PowerManager pm = (PowerManager) getSystemService(this.POWER_SERVICE);
pm.goToSleep(SystemClock.uptimeMillis());
}
When I click button I get error:
Neither user 10036 nor current process has android.permission.DEVICE_POWER.