0

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?

2 Answers2

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.

CommonsWare
  • 910,778
  • 176
  • 2,215
  • 2,253
1

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.

kichik
  • 28,340
  • 4
  • 77
  • 97