简体   繁体   English

未知管理员:ComponentInfo。 设备所有者无法使用命令dpm set-device-owner进行设置

[英]Unknown admin: ComponentInfo. Device owner not able to set using command dpm set-device-owner

I have done everithing needed to set device admin. 我已完成设置设备管理员所需的一切。 but when I run "dpm set-device-owner " always get unknown admin: Component info. 但是当我运行“ dpm set-device-owner”时,总是得到未知的管理员:组件信息。 I wnat to execute below code. 我要执行以下代码。 Every time i get security exception when i run below code 每当我在以下代码下运行时,遇到安全异常

   DevicePolicyManager deviceManager = ((DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE));
   deviceManager.installCaCert(localComponent, ret);

From your question, i see you are referring to 2 different things: device admin and device owner. 从您的问题中,我看到您指的是两种不同的东西:设备管理员和设备所有者。

  1. "I have done everything needed to set device admin" “我已完成设置设备管理员所需的一切”

What does everything mean? 什么意思 You asked from the code, doing the intent and waiting for the response as in this example? 您从代码中询问,是否如本例所示那样做意图并等待响应? Is it a proper way to get the response from Device Admin by onActivityResult 这是通过onActivityResult从设备管理器获取响应的正确方法

Have you tried the command from adb: dpm set-active-admin com.your.package/.your.device.admin.receiver ? 您是否尝试过adb中的命令:dpm set-active-admin com.your.package / .your.device.admin.receiver?

  1. "but when I run "dpm set-device-owner " always get unknown admin: Component info" “但是当我运行“ dpm set-device-owner”时,总是得到未知的管理员:组件信息”

This is on top of device admin, with higher privileges. 这是具有更高权限的设备管理员的顶部。 You do not need to be device owner to install a certificate, it can be done by requesting the user to approve it as here: Programmatically add a certificate authority while keeping Android system SSL certificates or using an api from a vendor, like Samsung Knox or LG. 您无需成为设备所有者即可安装证书,可以通过请求用户按如下所示批准它来完成:以编程方式添加证书颁发机构,同时保留Android系统SSL证书或使用供应商提供的api,例如Samsung Knox或LG。

You can always (if device allows it, only for testing) to enable your app as device owner by doing dpm set-active-owner com.your.package/.your.device.admin.receiver 通过执行dpm set-active-owner com.your.package / .your.device.admin.receiver,您可以始终(如果设备允许,仅用于测试)将您的应用启用为设备所有者

https://developers.google.com/android/work/prov-devices - documentation on how to provision your device with Device owner without ADB (end user devices) https://developers.google.com/android/work/prov-devices-有关如何在没有ADB的情况下向具有设备所有者的设备进行配置的文档(最终用户设备)

DPM actions:

usage: dpm [subcommand] [options]
usage: dpm set-active-admin [ --user <USER_ID> ] <COMPONENT>
usage: dpm set-device-owner <COMPONENT>
usage: dpm set-profile-owner [ --user <USER_ID> ] <COMPONENT>

dpm set-active-admin: Sets the given component as active admin for an existing user.

dpm set-device-owner: Sets the given component as active admin, and its
  package as device owner.

dpm set-profile-owner: Sets the given component as active admin and profile  owner for an existing user.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM