2

在此处输入图像描述我正在使用 Android 策略管理器,以下代码适用于Android 5.0.x移动设备。

Intent deviceAdminIntent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
                deviceAdminIntent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, cdmDeviceAdmin);
                deviceAdminIntent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,
                                           getResources().getString(R.string.device_admin_enable_alert));
                startActivityForResult(deviceAdminIntent, ACTIVATION_REQUEST);

但是,当我在具有相同OS版本的 Android TV 图像上部署相同的图像时,会引发以下异常。可能是什么问题?我在哪里可以找到图像的来源1Android TV

E/AgentApplication: UncaughtExceptionHandler got an exception
                    java.lang.RuntimeException: Unable to start activity ComponentInfo{xxxxx}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.app.action.ADD_DEVICE_ADMIN (has extras) }
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                        at android.app.ActivityThread.-wrap11(ActivityThread.java)
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                        at android.os.Handler.dispatchMessage(Handler.java:102)
                        at android.os.Looper.loop(Looper.java:148)
                        at android.app.ActivityThread.main(ActivityThread.java:5417)
                        at java.lang.reflect.Method.invoke(Native Method)
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                     Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.app.action.ADD_DEVICE_ADMIN (has extras) }
                        at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1798)
                        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1512)
                        at android.app.Activity.startActivityForResult(Activity.java:3917)
                        at android.app.Activity.startActivityForResult(Activity.java:3877)

1 . https://github.com/android/platform_frameworks_base/blob/master/core/java/android/app/admin/DevicePolicyManager.java

4

0 回答 0