Skip to content

Most visited

Recently visited

navigation

DeviceManager

DeviceManager

public class DeviceManager
extends Object

java.lang.Object
   ↳ com.google.android.things.device.DeviceManager


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 and restores the device to its initial state following the most recent software update. Apps have the option of additionally erasing shared external storage.

 DeviceManager deviceManager = new DeviceManager();
 // 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 = new DeviceManager();
 LocaleList newlist = new LocaleList();
 // ...add to the list...
 deviceManager.setSystemLocales(newlist);

Summary

Public constructors

DeviceManager()

Public methods

void factoryReset(boolean wipeExternalStorage)

Perform device factory reset.

void reboot()

Perform device reboot with default parameters.

void setSystemLocales(LocaleList localeList)

Set the list of preferred system locales.

Inherited methods

From class java.lang.Object

Public constructors

DeviceManager

DeviceManager ()

Public methods

factoryReset

void factoryReset (boolean wipeExternalStorage)

Perform device factory reset.

Parameters
wipeExternalStorage boolean: Indicates whether external storage should be cleared.
Throws
IllegalStateException if the underlying system service is not ready.
RuntimeException if the underlying system service encountered an error.
SecurityException if the calling context does not have com.google.android.things.permission.MASTER_CLEAR permission

reboot

void reboot ()

Perform device reboot with default parameters.

Throws
IllegalStateException if the underlying system service is not ready.
RuntimeException if the underlying system service encountered an error.
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.

Parameters
localeList LocaleList: the list of preferred system locales. The order the locale appears in this list determines its priority for being used.
Throws
IllegalArgumentException if locale list is empty.
IllegalStateException if the underlying system service is not ready.
RuntimeException if the underlying system service encountered an error.
SecurityException if the calling context does not have com.google.android.things.permission.MODIFY_LOCALE_SETTINGS permission
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)