Feature for getSystemAvailableFeatures() and hasSystemFeature(String).
The device supports device policy enforcement via device admins.
Constant Value: "android.software.device_admin"
Constant Value: "android.software.device_admin"
1. Get a PackageManager Instance and save to myPackageManager.
2. Create a Boolean Variable named bolPESupported.
3. Set the Minimum and Target SDK version to 19 or greater.
4. In the onCreate method, add the below code. This will return the policy enforcement ability to a boolean named bolPESupported. It will then display a toast displaying the policy enforcement ability on the device to the user.
bolPESupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_DEVICE_ADMIN);
if (bolPESupported) {
Toast.makeText(this, "Device has Policy Enforcement Capability", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "No Policy Enforcement capability!", Toast.LENGTH_LONG).show();
}
5. Compile and run!
Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_DEVICE_ADMIN
Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_DEVICE_ADMIN