Home > Mobile >  How to programmatically turn on (Power-On) the android device at a certain time?
How to programmatically turn on (Power-On) the android device at a certain time?

Time:06-30

How to implement it in Android Studio(API LEVEL >= 17) in my App(System-App rooted device)?

I know it is possible because my phone(Lenovo A516) and some others have this feature --->>>Screenshot<<<---

..need some ideas to start with.. Can i use AlarmClock for this?

CodePudding user response:

@PM77-1 did answer your question. In AOSP, there is no API that will turn on the phone (from an off state) at a given time. However, some phones do support this functionality but its implementation is dependent on the phone. In general, there is no way to turn a phone on from the off state (regardless of root privileges and system permission). That being said, there is a way to reboot a phone. but funnily enough there is no way to programmatically power a phone down. (OP has root, this doesn't apply)

CodePudding user response:

I've done a "bit" of digging, but still might not work.

(Please don't remind me that it might not work.)

Since you're telling us that you have access to the System and it's a rooted device,

I think you have a way to access android.permission.DEVICE_POWER.

Firstly, you have to find a way to sign your app as a System app or get additional permissions

(Which I assume you already have):

Thread one, Thread two, Thread Three

And then find a way so that your app may sit in the background even if the device is powered off.

(Which seems impossible, but you might find it out if you experiment as a system app.)

Your idea to use AlarmClock won't work flawlessly since it would mostly show the alarm, and then once dismissed the phone would go back to it's "powered-off state" or never show up at all.

Will come back for updates, or delete my answer.

Edit:

Eek, you already found the answer for your phone, didn't read that in the question earlier, maybe close this thread or edit it to include much more specific info?

Edit 2:

If you have already found a way for your app to work in the background while the device is powered off for some reason, you could try to reboot it using your root access ( su reboot / sudo reboot )

  • Related