Does Google Photos Upload Again After Metadata Update

Device admin deprecation. Starting with Android 9 (API level 28), some admin policies will exist marked as deprecated when invoked by a device admin. We recommend you first to prepare now for this modify. To learn more than and run across the migration options, read Device admin deprecation.

Android includes support for enterprise apps past offering the Android Device Administration API. The Device Assistants API provides device administration features at the arrangement level. These APIs allow y'all to create security-enlightened apps that are useful in enterprise settings, in which It professionals require rich control over employee devices. For instance, the congenital-in Android Email app has leveraged these APIs to ameliorate Exchange support. Through the Email app, Exchange administrators can enforce password policies — including alphanumeric passwords or numeric PINs — across devices. Administrators can also remotely wipe (that is, restore factory defaults on) lost or stolen handsets. Exchange users can sync their electronic mail and calendar information.

This document is intended for developers who desire to develop enterprise solutions for Android-powered devices. It discusses the diverse features provided past the Device Administration API to provide stronger security for employee devices that are powered by Android.

Note For information on building a Piece of work Policy Controller for Android for Work deployments, see Build a Device Policy Controller.

Device administration API overview

Hither are examples of the types of apps that might use the Device Administration API:

  • E-mail clients.
  • Security apps that exercise remote wipe.
  • Device management services and apps.

How does it piece of work?

Yous use the Device Administration API to write device admin apps that users install on their devices. The device admin app enforces the desired policies. Here's how information technology works:

  • A system administrator writes a device admin app that enforces remote/local device security policies. These policies could be hard-coded into the app, or the app could dynamically fetch policies from a third-party server.
  • The app is installed on users' devices. Android does not currently take an automatic provisioning solution. Some of the ways a sysadmin might distribute the app to users are as follows:
    • Google Play.
    • Enabling installation from another shop.
    • Distributing the app through other means, such as electronic mail or websites.
  • The arrangement prompts the user to enable the device admin app. How and when this happens depends on how the app is implemented.
  • Once users enable the device admin app, they are subject area to its policies. Complying with those policies typically confers benefits, such as access to sensitive systems and data.

If users practise not enable the device admin app, it remains on the device, but in an inactive state. Users will non exist subject to its policies, and they volition conversely not get any of the app's benefits—for example, they may non be able to sync data.

If a user fails to comply with the policies (for example, if a user sets a password that violates the guidelines), it is upward to the app to decide how to handle this. However, typically this volition result in the user not being able to sync data.

If a device attempts to connect to a server that requires policies non supported in the Device Administration API, the connectedness will not be allowed. The Device Administration API does not currently allow partial provisioning. In other words, if a device (for example, a legacy device) does not support all of the stated policies, there is no way to allow the device to connect.

If a device contains multiple enabled admin apps, the strictest policy is enforced. At that place is no way to target a particular admin app.

To uninstall an existing device admin app, users need to kickoff unregister the app as an administrator.

Policies

In an enterprise setting, it'due south often the case that employee devices must adhere to a strict ready of policies that govern the use of the device. The Device Assistants API supports the policies listed in Table 1. Notation that the Device Administration API currently only supports passwords for screen lock:

Table 1. Policies supported by the Device Administration API.

Policy Clarification
Password enabled Requires that devices ask for Pivot or passwords.
Minimum countersign length Set the required number of characters for the password. For example, you can require PIN or passwords to accept at least half-dozen characters.
Alphanumeric password required Requires that passwords have a combination of messages and numbers. They may include symbolic characters.
Circuitous password required Requires that passwords must incorporate at least a letter of the alphabet, a numerical digit, and a special symbol. Introduced in Android iii.0.
Minimum letters required in password The minimum number of messages required in the password for all admins or a particular one. Introduced in Android 3.0.
Minimum lowercase letters required in password The minimum number of lowercase letters required in the password for all admins or a particular i. Introduced in Android 3.0.
Minimum non-letter of the alphabet characters required in password The minimum number of non-letter of the alphabet characters required in the password for all admins or a particular i. Introduced in Android 3.0.
Minimum numerical digits required in countersign The minimum number of numerical digits required in the password for all admins or a particular one. Introduced in Android 3.0.
Minimum symbols required in password The minimum number of symbols required in the password for all admins or a particular one. Introduced in Android 3.0.
Minimum uppercase letters required in password The minimum number of uppercase letters required in the password for all admins or a item one. Introduced in Android three.0.
Password expiration timeout When the countersign will expire, expressed as a delta in milliseconds from when a device admin sets the expiration timeout. Introduced in Android iii.0.
Countersign history restriction This policy prevents users from reusing the last n unique passwords. This policy is typically used in conjunction with setPasswordExpirationTimeout(), which forces users to update their passwords afterwards a specified amount of time has elapsed. Introduced in Android 3.0.
Maximum failed password attempts Specifies how many times a user tin enter the wrong password before the device wipes its information. The Device Assistants API also allows administrators to remotely reset the device to factory defaults. This secures data in case the device is lost or stolen.
Maximum inactivity time lock Sets the length of time since the user final touched the screen or pressed a button before the device locks the screen. When this happens, users need to enter their Pivot or passwords again before they tin can utilise their devices and access data. The value tin can be between 1 and hour.
Require storage encryption Specifies that the storage area should be encrypted, if the device supports it. Introduced in Android 3.0.
Disable camera Specifies that the camera should exist disabled. Note that this doesn't take to be a permanent disabling. The photographic camera tin can be enabled/disabled dynamically based on context, fourth dimension, and so on. Introduced in Android 4.0.

Other features

In addition to supporting the policies listed in the above table, the Device Administration API lets you do the following:

  • Prompt user to set a new countersign.
  • Lock device immediately.
  • Wipe the device's data (that is, restore the device to its factory defaults).

Sample app

The examples used in this document are based on the Device Assistants API sample, which is included in the SDK samples (available through the Android SDK Manager) and located on your organization every bit <sdk_root>/ApiDemos/app/src/main/coffee/com/example/android/apis/app/DeviceAdminSample.java.

The sample app offers a demo of device admin features. It presents users with a user interface that lets them enable the device admin app. Once they've enabled the app, they can use the buttons in the user interface to do the following:

  • Set password quality.
  • Specify requirements for the user's password, such as minimum length, the minimum number of numeric characters information technology must contain, and then on.
  • Set the countersign. If the password does non suit to the specified policies, the organization returns an error.
  • Set how many failed countersign attempts can occur before the device is wiped (that is, restored to factory settings).
  • Set how long from now the countersign will expire.
  • Set the password history length (length refers to number of erstwhile passwords stored in the history). This prevents users from reusing one of the last n passwords they previously used.
  • Specify that the storage area should exist encrypted, if the device supports it.
  • Set the maximum amount of inactive fourth dimension that can elapse before the device locks.
  • Make the device lock immediately.
  • Wipe the device'due south data (that is, restore factory settings).
  • Disable the camera.

Figure 1. Screenshot of the sample app

Developing a device administration app

System administrators can use the Device Assistants API to write an app that enforces remote/local device security policy enforcement. This section summarizes the steps involved in creating a device assistants app.

Creating the manifest

To utilize the Device Administration API, the app's manifest must include the following:

  • A subclass of DeviceAdminReceiver that includes the following:
    • The BIND_DEVICE_ADMIN permission.
    • The ability to reply to the ACTION_DEVICE_ADMIN_ENABLED intent, expressed in the manifest as an intent filter.
  • A announcement of security policies used in metadata.

Here is an excerpt from the Device Assistants sample manifest:

<activity android:name=".app.DeviceAdminSample"             android:characterization="@string/activity_sample_device_admin">     <intent-filter>         <action android:name="android.intent.action.Principal" />         <category android:proper noun="android.intent.category.SAMPLE_CODE" />     </intent-filter> </activity> <receiver android:name=".app.DeviceAdminSample$DeviceAdminSampleReceiver"         android:label="@cord/sample_device_admin"         android:description="@cord/sample_device_admin_description"         android:permission="android.permission.BIND_DEVICE_ADMIN">     <meta-data android:name="android.app.device_admin"             android:resource="@xml/device_admin_sample" />     <intent-filter>         <action android:name="android.app.activeness.DEVICE_ADMIN_ENABLED" />     </intent-filter> </receiver>

Note that:

  • The following attributes refer to string resources that for the sample app reside in ApiDemos/res/values/strings.xml. For more information about resources, see Application Resources.
    • android:label="@string/activity_sample_device_admin" refers to the user-readable characterization for the activity.
    • android:label="@string/sample_device_admin" refers to the user-readable label for the permission.
    • android:description="@string/sample_device_admin_description" refers to the user-readable description of the permission. A descripton is typically longer and more informative than a characterization.
  • android:permission="android.permission.BIND_DEVICE_ADMIN" is a permission that a DeviceAdminReceiver bracket must accept, to ensure that just the system tin can interact with the receiver (no app can be granted this permission). This prevents other apps from abusing your device admin app.
  • android.app.action.DEVICE_ADMIN_ENABLED is the primary action that a DeviceAdminReceiver bracket must handle to be immune to manage a device. This is set to the receiver when the user enables the device admin app. Your code typically handles this in onEnabled(). To be supported, the receiver must as well require the BIND_DEVICE_ADMIN permission so that other apps cannot corruption it.
  • When a user enables the device admin app, that gives the receiver permission to perform actions in response to the broadcast of item arrangement events. When suitable event arises, the app tin impose a policy. For example, if the user attempts to gear up a new password that doesn't run across the policy requirements, the app can prompt the user to pick a different password that does run into the requirements.
  • Avoid changing the receiver name subsequently publishing your app. If the name in the manifest changes, device admin is disabled when users update the app. To acquire more, meet <receiver>.
  • android:resource="@xml/device_admin_sample" declares the security policies used in metadata. The metadata provides additional data specific to the device administrator, as parsed by the DeviceAdminInfo grade. Here are the contents of device_admin_sample.xml:
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">   <uses-policies>     <limit-password />     <watch-login />     <reset-countersign />     <force-lock />     <wipe-information />     <expire-password />     <encrypted-storage />     <disable-camera />   </uses-policies> </device-admin>        

When designing your device administration app, you don't demand to include all of the policies, just the ones that are relevant for your app.

For more discussion of the manifest file, see the Android Developers Guide.

Implementing the code

The Device Administration API includes the post-obit classes:

DeviceAdminReceiver
Base of operations class for implementing a device administration component. This class provides a convenience for interpreting the raw intent actions that are sent by the organisation. Your Device Administration app must include a DeviceAdminReceiver subclass.
DevicePolicyManager
A class for managing policies enforced on a device. Most clients of this class must have published a DeviceAdminReceiver that the user has currently enabled. The DevicePolicyManager manages policies for one or more DeviceAdminReceiver instances
DeviceAdminInfo
This course is used to specify metadata for a device administrator component.

These classes provide the foundation for a fully functional device administration app. The residue of this section describes how you lot use the DeviceAdminReceiver and DevicePolicyManager APIs to write a device admin app.

Subclassing DeviceAdminReceiver

To create a device admin app, you must bracket DeviceAdminReceiver. The DeviceAdminReceiver class consists of a series of callbacks that are triggered when particular events occur.

In its DeviceAdminReceiver bracket, the sample app simply displays a Toast notification in response to particular events. For example:

Kotlin

grade DeviceAdminSample : DeviceAdminReceiver() {      private fun showToast(context: Context, msg: String) {         context.getString(R.string.admin_receiver_status, msg).let { status ->             Toast.makeText(context, condition, Toast.LENGTH_SHORT).prove()         }     }      override fun onEnabled(context: Context, intent: Intent) =             showToast(context, context.getString(R.string.admin_receiver_status_enabled))      override fun onDisableRequested(context: Context, intent: Intent): CharSequence =             context.getString(R.string.admin_receiver_status_disable_warning)      override fun onDisabled(context: Context, intent: Intent) =             showToast(context, context.getString(R.string.admin_receiver_status_disabled))      override fun onPasswordChanged(context: Context, intent: Intent, userHandle: UserHandle) =             showToast(context, context.getString(R.string.admin_receiver_status_pw_changed)) ... }            

Java

public class DeviceAdminSample extends DeviceAdminReceiver {      void showToast(Context context, String msg) {         String status = context.getString(R.string.admin_receiver_status, msg);         Toast.makeText(context, status, Toast.LENGTH_SHORT).show();     }      @Override     public void onEnabled(Context context, Intent intent) {         showToast(context, context.getString(R.string.admin_receiver_status_enabled));     }      @Override     public CharSequence onDisableRequested(Context context, Intent intent) {         return context.getString(R.string.admin_receiver_status_disable_warning);     }      @Override     public void onDisabled(Context context, Intent intent) {         showToast(context, context.getString(R.cord.admin_receiver_status_disabled));     }      @Override     public void onPasswordChanged(Context context, Intent intent, UserHandle userHandle) {         showToast(context, context.getString(R.string.admin_receiver_status_pw_changed));     } ... }            

Enabling the app

One of the major events a device admin app has to handle is the user enabling the app. The user must explicitly enable the app for the policies to be enforced. If the user chooses not to enable the app it will still exist present on the device, but its policies will not be enforced, and the user will not become whatever of the app's benefits.

The process of enabling the app begins when the user performs an action that triggers the ACTION_ADD_DEVICE_ADMIN intent. In the sample app, this happens when the user clicks the Enable Admin checkbox.

When the user clicks the Enable Admin checkbox, the display changes to prompt the user to activate the device admin app, equally shown in figure ii.

Figure 2. Sample app: activating the app

Beneath is the code that gets executed when the user clicks the Enable Admin checkbox. This has the outcome of triggering the onPreferenceChange() callback. This callback is invoked when the value of this Preference has been changed by the user and is about to be set and/or persisted. If the user is enabling the app, the display changes to prompt the user to activate the device admin app, equally shown in effigy 2. Otherwise, the device admin app is disabled.

Kotlin

override fun onPreferenceChange(preference: Preference, newValue: Any): Boolean {     if (super.onPreferenceChange(preference, newValue)) return true     val value = newValue as Boolean     if (preference == enableCheckbox) {         if (value != adminActive) {             if (value) {                 // Launch the activity to accept the user enable our admin.                 val intent = Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN).apply {                     putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, deviceAdminSample)                     putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,                             activity.getString(R.cord.add_admin_extra_app_text))                 }                 startActivityForResult(intent, REQUEST_CODE_ENABLE_ADMIN)                 // return faux - don't update checkbox until we're actually agile                 return false             } else {                 dpm.removeActiveAdmin(deviceAdminSample)                 enableDeviceCapabilitiesArea(false)                 adminActive = false             }         }     } else if (preference == disableCameraCheckbox) {         dpm.setCameraDisabled(deviceAdminSample, value)     }     render truthful }            

Java

@Override public boolean onPreferenceChange(Preference preference, Object newValue) {     if (super.onPreferenceChange(preference, newValue)) {         render truthful;     }     boolean value = (Boolean) newValue;     if (preference == enableCheckbox) {         if (value != adminActive) {             if (value) {                 // Launch the activeness to have the user enable our admin.                 Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);                 intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, deviceAdminSample);                 intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,                         activity.getString(R.string.add_admin_extra_app_text));                 startActivityForResult(intent, REQUEST_CODE_ENABLE_ADMIN);                 // render false - don't update checkbox until we're actually active                 render false;             } else {                 dpm.removeActiveAdmin(deviceAdminSample);                 enableDeviceCapabilitiesArea(false);                 adminActive = false;             }         }     } else if (preference == disableCameraCheckbox) {         dpm.setCameraDisabled(deviceAdminSample, value);     }     return true; }            

The line intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, mDeviceAdminSample) states that mDeviceAdminSample (which is a DeviceAdminReceiver component) is the target policy. This line invokes the user interface shown in figure two, which guides users through adding the device administrator to the system (or allows them to reject it).

When the app needs to perform an operation that is contingent on the device admin app being enabled, it confirms that the app is active. To practice this it uses the DevicePolicyManager method isAdminActive(). Find that the DevicePolicyManager method isAdminActive() takes a DeviceAdminReceiver component equally its statement:

Kotlin

private lateinit var dpm: DevicePolicyManager ... private fun isActiveAdmin(): Boolean = dpm.isAdminActive(deviceAdminSample)            

Java

DevicePolicyManager dpm; ... private boolean isActiveAdmin() {     render dpm.isAdminActive(deviceAdminSample); }            

Managing policies

DevicePolicyManager is a public course for managing policies enforced on a device. DevicePolicyManager manages policies for one or more than DeviceAdminReceiver instances.

Y'all get a handle to the DevicePolicyManager as follows:

Kotlin

dpm = getSystemService(Context.DEVICE_POLICY_SERVICE) as DevicePolicyManager            

Coffee

DevicePolicyManager dpm =     (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);            

This section describes how to utilise DevicePolicyManager to perform administrative tasks:

  • Gear up countersign policies
  • Prepare device lock
  • Perform information wipe

Set password policies

DevicePolicyManager includes APIs for setting and enforcing the device password policy. In the Device Administration API, the password just applies to screen lock. This section describes common password-related tasks.

Gear up a password for the device

This code displays a user interface prompting the user to fix a password:

Kotlin

Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD).also { intent ->     startActivity(intent) }            

Coffee

Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD); startActivity(intent);            
Set the countersign quality

The countersign quality tin be i of the following DevicePolicyManager constants:

PASSWORD_QUALITY_ALPHABETIC
The user must enter a password containing at least alphabetic (or other symbol) characters.
PASSWORD_QUALITY_ALPHANUMERIC
The user must enter a password containing at least both numeric and alphabetic (or other symbol) characters.
PASSWORD_QUALITY_NUMERIC
The user must enter a password containing at least numeric characters.
PASSWORD_QUALITY_COMPLEX
The user must take entered a password containing at least a letter of the alphabet, a numerical digit and a special symbol.
PASSWORD_QUALITY_SOMETHING
The policy requires some kind of password, just doesn't care what it is.
PASSWORD_QUALITY_UNSPECIFIED
The policy has no requirements for the password.

For example, this is how you would set the password policy to crave an alphanumeric password:

Kotlin

individual lateinit var dpm: DevicePolicyManager private lateinit var deviceAdminSample: ComponentName ... dpm.setPasswordQuality(deviceAdminSample, DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC)            

Java

DevicePolicyManager dpm; ComponentName deviceAdminSample; ... dpm.setPasswordQuality(deviceAdminSample, DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC);            
Set countersign content requirements

Beginning with Android 3.0, the DevicePolicyManager grade includes methods that permit you lot fine-tune the contents of the countersign. For example, yous could fix a policy that states that passwords must contain at least n uppercase letters. Here are the methods for fine-tuning a password's contents:

  • setPasswordMinimumLetters()
  • setPasswordMinimumLowerCase()
  • setPasswordMinimumUpperCase()
  • setPasswordMinimumNonLetter()
  • setPasswordMinimumNumeric()
  • setPasswordMinimumSymbols()

For example, this snippet states that the password must have at least two uppercase letters:

Kotlin

private lateinit var dpm: DevicePolicyManager private lateinit var deviceAdminSample: ComponentName individual val pwMinUppercase = 2 ... dpm.setPasswordMinimumUpperCase(deviceAdminSample, pwMinUppercase)            

Java

DevicePolicyManager dpm; ComponentName deviceAdminSample; int pwMinUppercase = two; ... dpm.setPasswordMinimumUpperCase(deviceAdminSample, pwMinUppercase);            
Set the minimum password length

You can specify that a password must be at least the specified minimum length. For example:

Kotlin

individual lateinit var dpm: DevicePolicyManager individual lateinit var deviceAdminSample: ComponentName private val pwLength: Int = ... ... dpm.setPasswordMinimumLength(deviceAdminSample, pwLength)            

Coffee

DevicePolicyManager dpm; ComponentName deviceAdminSample; int pwLength; ... dpm.setPasswordMinimumLength(deviceAdminSample, pwLength);            
Fix maximum failed countersign attempts

You can fix the maximum number of immune failed password attempts before the device is wiped (that is, reset to factory settings). For instance:

Kotlin

val dPM:DevicePolicyManager individual lateinit var dpm: DevicePolicyManager private lateinit var deviceAdminSample: ComponentName individual val maxFailedPw: Int = ... ... dpm.setMaximumFailedPasswordsForWipe(deviceAdminSample, maxFailedPw)            

Java

DevicePolicyManager dpm; ComponentName deviceAdminSample; int maxFailedPw;  ... dpm.setMaximumFailedPasswordsForWipe(deviceAdminSample, maxFailedPw);            
Set countersign expiration timeout

Beginning with Android three.0, you can employ the setPasswordExpirationTimeout() method to set when a countersign volition expire, expressed equally a delta in milliseconds from when a device admin sets the expiration timeout. For case:

Kotlin

private lateinit var dpm: DevicePolicyManager private lateinit var deviceAdminSample: ComponentName private val pwExpiration: Long = ... ... dpm.setPasswordExpirationTimeout(deviceAdminSample, pwExpiration)            

Java

DevicePolicyManager dpm; ComponentName deviceAdminSample; long pwExpiration; ... dpm.setPasswordExpirationTimeout(deviceAdminSample, pwExpiration);            
Restrict password based on history

Beginning with Android iii.0, you tin can employ the setPasswordHistoryLength() method to limit users' ability to reuse sometime passwords. This method takes a length parameter, which specifies how many onetime passwords are stored. When this policy is active, users cannot enter a new countersign that matches the terminal n passwords. This prevents users from using the aforementioned password over and over. This policy is typically used in conjunction with setPasswordExpirationTimeout(), which forces users to update their passwords after a specified amount of fourth dimension has elapsed.

For example, this snippet prohibits users from reusing any of their last 5 passwords:

Kotlin

individual lateinit var dpm: DevicePolicyManager private lateinit var deviceAdminSample: ComponentName individual val pwHistoryLength = 5 ... dpm.setPasswordHistoryLength(deviceAdminSample, pwHistoryLength)            

Java

DevicePolicyManager dpm; ComponentName deviceAdminSample; int pwHistoryLength = 5; ... dpm.setPasswordHistoryLength(deviceAdminSample, pwHistoryLength);            

Set device lock

Yous can set the maximum period of user inactivity that can occur before the device locks. For example:

Kotlin

private lateinit var dpm: DevicePolicyManager private lateinit var deviceAdminSample: ComponentName private val timeMs: Long = 1000L * timeout.text.toString().toLong() ... dpm.setMaximumTimeToLock(deviceAdminSample, timeMs)            

Coffee

DevicePolicyManager dpm; ComponentName deviceAdminSample; ... long timeMs = 1000L*Long.parseLong(timeout.getText().toString()); dpm.setMaximumTimeToLock(deviceAdminSample, timeMs);            

Y'all can likewise programmatically tell the device to lock immediately:

Kotlin

individual lateinit var dpm: DevicePolicyManager dpm.lockNow()            

Java

DevicePolicyManager dpm; dpm.lockNow();            

Perform data wipe

You lot can use the DevicePolicyManager method wipeData() to reset the device to factory settings. This is useful if the device is lost or stolen. Often the decision to wipe the device is the result of sure conditions beingness met. For example, y'all can use setMaximumFailedPasswordsForWipe() to state that a device should exist wiped after a specific number of failed password attempts.

You lot wipe information as follows:

Kotlin

private lateinit var dpm: DevicePolicyManager dpm.wipeData(0)            

Java

DevicePolicyManager dpm; dpm.wipeData(0);            

The wipeData() method takes as its parameter a fleck mask of additional options. Currently the value must be 0.

Disable camera

Beginning with Android iv.0, you lot can disable the camera. Note that this doesn't accept to be a permanent disabling. The camera tin can be enabled/disabled dynamically based on context, fourth dimension, and so on.

You lot control whether the camera is disabled by using the setCameraDisabled() method. For example, this snippet sets the camera to be enabled or disabled based on a checkbox setting:

Kotlin

individual lateinit var disableCameraCheckbox: CheckBoxPreference private lateinit var dpm: DevicePolicyManager private lateinit var deviceAdminSample: ComponentName ... dpm.setCameraDisabled(deviceAdminSample, mDisableCameraCheckbox.isChecked)            

Coffee

private CheckBoxPreference disableCameraCheckbox; DevicePolicyManager dpm; ComponentName deviceAdminSample; ... dpm.setCameraDisabled(deviceAdminSample, mDisableCameraCheckbox.isChecked());            

Storage encryption

Beginning with Android three.0, yous can use the setStorageEncryption() method to set a policy requiring encryption of the storage area, where supported.

For case:

Kotlin

private lateinit var dpm: DevicePolicyManager private lateinit var deviceAdminSample: ComponentName ... dpm.setStorageEncryption(deviceAdminSample, truthful)            

Java

DevicePolicyManager dpm; ComponentName deviceAdminSample; ... dpm.setStorageEncryption(deviceAdminSample, truthful);            

See the Device Assistants API sample for a complete example of how to enable storage encryption.

Boosted lawmaking samples

The Android AppRestrictionEnforcer and DeviceOwner samples further demonstrate the use of the APIs covered on this page.

goodsonastaking.blogspot.com

Source: https://developer.android.com/guide/topics/admin/device-admin

0 Response to "Does Google Photos Upload Again After Metadata Update"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel