Automatic turn on in android device

北战南征 提交于 2019-12-13 03:45:35

问题


I want to develop an app whereby one of it functionality is power on the device when it be powered off. I searched in developer documents but I find anything related to it.

There is a way to set your device to automatic power on? like a scheduled task?


回答1:


There is nothing in the Android SDK itself for turning the device on from a fully-powered-off state. Some device manufacturers may have features for this, and some subset of those might have an API for it.




回答2:


This is possible on normal Linux machines with RTC wake alarm:

$ sudo sh -c "echo 0 > /sys/class/rtc/rtc0/wakealarm" 
$ sudo sh -c "echo `date '+%s' -d '+ 3 minutes'` > /sys/class/rtc/rtc0/wakealarm"

I have never tried this on Android, and if it does work, I'd imagine it requires rooting your device. Maybe that'd be good enough for your use case.

As @CommonsWare mentioned, some manufactures seem to support this as a setting. I'm not sure if they have an API, but that might also be worth researching. One of them seems to be Samsung.



来源:https://stackoverflow.com/questions/45446182/automatic-turn-on-in-android-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!