Hello to all. There is a need to take into account in the application interface off the phone.

Do not tell me where you could read about the method or what information is there on this?

  • Unclear. Are you going to programmatically turn off the phone from your program or when you turn off the phone to do something? Clarify the question! - Barmaley

1 answer 1

If it is a question of programmatically turning off / restarting the phone:

  1. this requires REBOOT permission in the manifest.
  2. the application must be signed with the system firmware key

With this permission, you can send the phone to reboot (do not turn off!) Via PowerManager.reboot()

Update

on the rutted machine, you can try to run

 Runtime.getRuntime().exec("su reboot"); 

can help - I do not know, have not tried.

  • Where can I get the system firmware key? - V_Tjuryakin
  • The keys from the supplier of the firmware ... In open firmware (like Cyanogen) they are and are somewhere in the depths of the source code - Barmaley
  • Is there an implementation of a similar function? Because This app will be hosted on Google Play. And it turns out, each phone has its own firmware and its own system firmware key, it turns out you need to pull it out somehow - V_Tjuryakin
  • Can it be easier through $ su reboot? - on a rooted apparatus should work ... - Barmaley
  • one
    @V_Tjuryakin, why should such things be conceived at all? Someone who may not really like it, that the FIG knows what kind of priladah thinks of himself . What will you do? - avp