简体   繁体   English

无法应用Android Enterprise政策

[英]Not able to apply Policy of Android Enterprise

I am creating an app with the use of Android Enterprise. 我正在使用Android Enterprise创建一个应用程序。

For that, I added dependencies in the build.gradle file. 为此,我在build.gradle文件中添加了依赖build.gradle

implementation 'com.google.apis:google-api-services-androidmanagement:v1-rev84-1.25.0'

I am trying to disable uninstalling application using below code from here 我正在尝试从此处使用以下代码禁用卸载应用程序

try{
    Policy policy = new Policy();
    policy.setUninstallAppsDisabled(true);
} catch (Exception e) {
    e.printStackTrace();
}

But above code is not working. 但是上面的代码不起作用。 No any Exception or Warning arise 不会出现任何异常或警告

What I am missing? 我缺少什么? Not able to found proper documentation that how to use Enterprise Management API. 无法找到有关如何使用企业管理API的适当文档。

Using the client library of the Android Management API from an Android app is not enough the manage the device the app is running on. 从Android应用程序使用Android Management API的客户端库不足以管理运行该应用程序的设备。 You need to first set up the device as managed. 您需要首先将设备设置为受管。 For that you can follow the instructions in the quickstart guide . 为此,您可以按照快速入门指南中的说明进行操作。

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

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