您是否在 device_admin_sample.xml 中设置了哪些管理策略符合您的应用程序预期行为?
将管理参数设置为
android:label="@string/enterprise_device_admin"
android:permission="android.permission.BIND_DEVICE_ADMIN">
android:resource="@xml/enterprise_device_admin" />
这是您的文件 device_admin_sample.xml 的典型内容:
<activity android:name=".app.DeviceAdminSample"
android:label="@string/activity_sample_device_admin">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<receiver android:name=".app.DeviceAdminSample$DeviceAdminSampleReceiver"
android:label="@string/sample_device_admin"
android:description="@string/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.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>
进一步阅读分步说明,也值得检查: