# DeviceManager

Summary:[Methods](https://developer.android.com/reference/com/google/android/things/device/DeviceManager#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/com/google/android/things/device/DeviceManager#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/com/google/android/things/device/DeviceManager#)  

# DeviceManager

`
public


class
DeviceManager
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | com.google.android.things.device.DeviceManager |

<br />

*** ** * ** ***

This class provides access to the device management service. Use this class to perform low-level device functions such as reboot and factory reset. Factory reset performs a wipe of all primary application[internal storage](https://developer.android.com/guide/topics/data/data-storage#filesInternal)and restores the device to its initial state following the most recent software update. Apps have the option of additionally erasing shared[external storage](https://developer.android.com/guide/topics/data/data-storage#filesExternal).  

     DeviceManager deviceManager = DeviceManager.getInstance();
     // Also erase shared external storage
     boolean wipeExternal = true;
     deviceManager.factoryReset(wipeExternal);

### Setting Device Locale

Use the`DeviceManager`to control the default set of preferred locales available on the device.  

     DeviceManager deviceManager = DeviceManager.getInstance();
     LocaleList newlist = new LocaleList();
     // ...add to the list...
     deviceManager.setSystemLocales(newlist);

<br />

## Summary

|                                                                                                                                                                                                  ### Public methods                                                                                                                                                                                                  ||
|-------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`                                                                                                           | ` `[factoryReset](https://developer.android.com/reference/com/google/android/things/device/DeviceManager#factoryReset(boolean))`(boolean wipeExternalStorage) ` Perform device factory reset.                                                                                                     |
| ` static `[DeviceManager](https://developer.android.com/reference/com/google/android/things/device/DeviceManager) | ` `[getInstance](https://developer.android.com/reference/com/google/android/things/device/DeviceManager#getInstance())`() ` Returns the[DeviceManager](https://developer.android.com/reference/com/google/android/things/device/DeviceManager)instance for this application.                      |
| ` void`                                                                                                           | ` `[reboot](https://developer.android.com/reference/com/google/android/things/device/DeviceManager#reboot())`() ` Perform device reboot with default parameters.                                                                                                                                  |
| ` void`                                                                                                           | ` `[setSystemLocales](https://developer.android.com/reference/com/google/android/things/device/DeviceManager#setSystemLocales(android.os.LocaleList))`(`[LocaleList](https://developer.android.com/reference/android/os/LocaleList.html)` localeList) ` Set the list of preferred system locales. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/com/google/android/things/device/DeviceManager#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                                                                                                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                                                                                                                                                                                                                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                                                                                                                                                                                                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                                                                                                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                                                                                                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                                                                                                                                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                                                                                                                                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                                                                                                                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long, int))`(long millis, int nanos) ` Causes the current thread to wait until another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long millis) ` Causes the current thread to wait until either another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object, or a specified amount of time has elapsed.                                                                 | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object.                                                                                                                                  | ||

## Public methods

### factoryReset

```
void factoryReset (boolean wipeExternalStorage)
```

Perform device factory reset.

<br />

|                                           Parameters                                           ||
|-----------------------|-------------------------------------------------------------------------|
| `wipeExternalStorage` | `boolean`: Indicates whether external storage should be cleared. <br /> |

|                                                                                                Throws                                                                                                ||
|--------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|
| [IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException) | if the underlying system service is not ready.                                                     |
| [RuntimeException](https://developer.android.com/reference/java/lang/RuntimeException)           | if the underlying system service encountered an error.                                             |
| [SecurityException](https://developer.android.com/reference/java/lang/SecurityException)         | if the calling context does not have com.google.android.things.permission.FACTORY_RESET permission |

### getInstance

```
DeviceManager getInstance ()
```

Returns the[DeviceManager](https://developer.android.com/reference/com/google/android/things/device/DeviceManager)instance for this application.

<br />

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [DeviceManager](https://developer.android.com/reference/com/google/android/things/device/DeviceManager) | The DeviceManager instance. <br /> |

### reboot

```
void reboot ()
```

Perform device reboot with default parameters.

<br />

|                                                                                            Throws                                                                                             ||
|--------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
| [IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException) | if the underlying system service is not ready.                                              |
| [RuntimeException](https://developer.android.com/reference/java/lang/RuntimeException)           | if the underlying system service encountered an error.                                      |
| [SecurityException](https://developer.android.com/reference/java/lang/SecurityException)         | if the calling context does not have com.google.android.things.permission.REBOOT permission |

### setSystemLocales

```
void setSystemLocales (LocaleList localeList)
```

Set the list of preferred system locales.

<br />

|                                                                         Parameters                                                                         ||
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `localeList` | `LocaleList`: the list of preferred system locales. The order the locale appears in this list determines its priority for being used. <br /> |

|                                                                                                   Throws                                                                                                   ||
|--------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if locale list is empty.                                                                           |
| [IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException)       | if the underlying system service is not ready.                                                     |
| [RuntimeException](https://developer.android.com/reference/java/lang/RuntimeException)                 | if the underlying system service encountered an error.                                             |
| [SecurityException](https://developer.android.com/reference/java/lang/SecurityException)               | if the calling context does not have com.google.android.things.permission.MODIFY_LOCALE permission |

-

  ## Classes

  - [DeviceManager](https://developer.android.com/reference/com/google/android/things/device/DeviceManager)
  - [TimeManager](https://developer.android.com/reference/com/google/android/things/device/TimeManager)