am aed4ced6: Android U Class: Developing Android Applications for the...
am aed4ced6: Android U Class: Developing Android Applications for the Enterprise. This class uses a sample app.
* commit 'aed4ced6':
Android U Class: Developing Android Applications for the Enterprise. This class uses a sample app.
en:'This is a security-aware sample application that demonstrates the enforcement of device administration policies on Android 2.2 or above platforms.'
<h2 id="CreateDeviceAdminReceiver">Create a Device Administration Receiver</h2>
<p>Create a Device Administration broadcast receiver, which gets notified of events related to the policies you’ve declared to support. An application can selectively override callback methods.</p>
<p>In the sample application, Device Admin, when the device administrator is deactivated by the
user, the configured policy is erased from the shared preference. You should consider implementing
business logic that is relevant to your use case. For example, the application might take some
actions to mitigate security risk by implementing some combination of deleting sensitive data on the
device, disabling remote synchronization, alerting an administrator, etc.</p>
<p>For the broadcast receiver to work, be sure to register it in the Android manifest as illustrated in the above snippet.</p>
<pre>
public static class PolicyAdmin extends DeviceAdminReceiver {
@Override
public void onDisabled(Context context, Intent intent) {
// Called when the app is about to be deactivated as a device administrator.