-1

How to shutdown and restart android device in my application. please give me a suggestion if is possible or not. I search a lot but no code work for me.

vivek tiwari
  • 645
  • 3
  • 10
  • 23
  • It would be interesting to know why you wish to do this? – Toby Allen Dec 04 '12 at 07:08
  • Ok. i tell you. actually i don't want to run my phone on night. so in specific time it will shut down and again it will restart on early morning.. have you any suggestion? – vivek tiwari Dec 04 '12 at 07:19

1 Answers1

3

Based on what you said your intentions are, what you want to do is not possible in Android. If you are rooted, you can shut down your phone, but there's no way to wake it up at a future time.

What you might want to look into is to simply put the phone to sleep as much as possible -- place it in Airplane mode and turn off sound. ... and then re-enable all that at a given time.

If you don't want to code it all yourself, there are various scheduling apps out there, including Tasker (which can do much more).

323go
  • 14,143
  • 6
  • 33
  • 41
  • thanks for this . u save my lot of time. sorry but R u sure that there is no possible way to wake up at a future? – vivek tiwari Dec 04 '12 at 08:15
  • 1
    I should clarify -- there's no *standard* way of waking up in the future. Some devices will support WakeByRTC functionality, but in order to access that from Android, you'd need to have kernel drivers to support this and create a jni module to access those drivers... and after all that work, it would only work on that one device. – 323go Dec 04 '12 at 17:46