Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
555 views
in Technique[技术] by (71.8m points)

shut down android device programmatically

I am trying to switch off android device through my program. It actually gets switched off but it restarts itself. I want the phone not to restart again by itself. How can I do that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This has been asked on StackOverflow in the past. The effective answer is that you would require the DEVICE_POWER permission in order to shut the phone completely off, but the user would need a rooted phone to give your app permission to that control anyway.

Best you could hope for is PowerManager.goToSleep()


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...