I am creating app(only for Android 6) in which I have to give reboot functionality using button click. I am using following code:
PowerManager pm =(PowerMan
You cannot do a reboot from an ordinary SDK application. Only applications signed with the system firmware signing key can do this. Copied from this answer,
Programmatically switching off Android phone
You need the system key to sign your app. See this post for details;
How to compile Android Application with system permissions
First, create a file device_owner.xml with following content:
Now do the following steps
adb push device_owner.xml /sdcard/
adb shell
su
cp /sdcard/device_owner.xml /data/system/
cd /data/system/
chown system:system device_owner.xml
reboot
Note : Before rebooting device, make sure that you installed the application, which you are trying to make device owner. If you will not do, you will get boot animation for infinite time.