장치 정책 관리자를 작동 시키려고하는데 사용하도록 설정하면 작동이 멈 춥니 다.장치 정책 관리자가 장치 정책을 검색 할 수 없습니다.
이10-05 10:39:07.147: WARN/DeviceAdminAdd(144): Unable to retrieve device policy ComponentInfo{test.devadmin/test.devadmin.DeviceAdmin$MyDeviceAdminReceiver}
10-05 10:39:07.147: WARN/DeviceAdminAdd(144): android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{test.devadmin/test.devadmin.DeviceAdmin$MyDeviceAdminReceiver}
매니페스트 :
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".DeviceAdmin" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".app.DeviceAdmin$Controller"
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="MyDeviceAdminReceiver"
android:label="@string/app_label"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data android:name="android.app.device_admin"
android:resource="@xml/device_admin" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>
</application>
</manifest>
device_admin.xml이 방법
public void enable() {
if (!mDPM.isAdminActive(mDeviceAdmin)) {
Intent intent = new Intent(
DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN,
mDeviceAdmin);
intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,
"Additional text explaining why this needs to be added.");
startActivityForResult(intent, REQUEST_ENABLE);
} else {
mDPM.lockNow();
}
리시버 클래스를 가능하게
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
<limit-password />
<watch-login />
<reset-password />
<force-lock />
<wipe-data />
</uses-policies>
</device-admin>
이 basicly입니다 오류에 대한 많은 이미 점점 공격적를 봤 명사와 같음 여기 D : http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.html
http://rootfs.wordpress.com/2010/09/09/android-make-your-application-a-device-administrator/
어떤 도움이나 조언이 많이 주시면 감사하겠습니다!
수신자 이름은 수신자이어야합니다. android : name = ". MyDeviceAdminReceiver" – SudP
@ user980188 : Sudhir28이 맞습니다. 너 해봤 어? –
감사합니다.
Ton