Reboot programmatically Android Things

前端 未结 4 1479
忘掉有多难
忘掉有多难 2020-12-19 20:38

I want to use this code in order to reboot my RPI3 running Android Things:

public static void Reboot()
{
    try {
        Process proc = R         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-19 20:48

    You can now do a reboot using:

    https://developer.android.com/things/reference/com/google/android/things/devicemanagement/DeviceManager.html

    Example

     public class SomeActivity extends Activity {
    
         void doReboot() {
             DeviceManager.getInstance().reboot();
         }
    
         void doFactoryReset() {
             boolean wipeExternalCard = true;
             DeviceManager.getInstance().factoryReset(wipeExternalCard);
         }
      }
    

    You need the com.google.android.things.permission.REBOOT permission

提交回复
热议问题