AndroidEnterprise-enablewithGoogleWorkspaceEnterpriseID
创始人
2024-10-07 16:30:43
0

将Android设备设置为Android Enterprise,并将其与Google Workspace EnterpriseID相关联,以实现设备管理和安全性。

示例代码:

//检查设备是否支持Android企业版 PackageManager pm = getPackageManager(); boolean isDeviceSupportsAndroidForWork = pm.hasSystemFeature(PackageManager.FEATURE_DEVICE_ADMIN);

//创建Android设备管理员 DevicePolicyManager mDevicePolicyManager = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE); ComponentName mAdminComponentName = new ComponentName(MainActivity.this, DeviceAdminReceiver.class);

//检查是否为设备管理员 boolean isActiveDeviceAdmin = mDevicePolicyManager.isAdminActive(mAdminComponentName);

//检查设备是否已启用Android企业版 boolean isAndroidForWorkEnabled = mDevicePolicyManager.isProfileOwnerApp(getPackageName());

//启用Android企业版 if (isDeviceSupportsAndroidForWork && !isAndroidForWorkEnabled) { //设置Google Workspace EnterpriseID final String enterpriseId = "enterprise_id"; Intent intent = new Intent(DevicePolicyManager.ACTION_PROVISION_MANAGED_DEVICE); intent.putExtra(DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME, getPackageName()); intent.putExtra(DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME, mAdminComponentName); intent.putExtra(DevicePolicyManager.EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE, bundleExtras(enterpriseId)); startActivityForResult(intent, CODE_ENABLE_ADMIN); }

private Bundle bundleExtras(String enterpriseId) { Bundle extras = new Bundle(); if (enterpriseId != null && !enterpriseId.isEmpty()) { extras.putString(DevicePolicyManager.EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED, enterpriseId); } return extras; }

相关内容

热门资讯

佛手在线大菠萝为什么都输!hh... 佛手在线大菠萝为什么都输!hhpoker开挂教程(透视)方法-真是辅助真的是有挂1)佛手在线大菠萝为...
透视详情!约局吧如何查看是否有... 透视详情!约局吧如何查看是否有挂(透视)哈糖大菠萝怎么开挂,教程总结(有挂规律)-哔哩哔哩一、约局吧...
约局吧德州透视!wepoker... 约局吧德州透视!wepoker辅助透视软件(透视)教程-一直辅助存在有挂1、下载好wepoker辅助...
透视必备!hhpoker有后台... 透视必备!hhpoker有后台操作吗(透视)红龙poker辅助工具,教程法门(有挂秘笈)-哔哩哔哩1...
wpk模拟器是什么!wepok... wpk模拟器是什么!wepoker-h5下载(透视)脚本-切实有挂存在有挂1、用户打开应用后不用登录...
透视透视!werplan辅助软... 透视透视!werplan辅助软件(透视)wpk透视辅助,教程总结(有挂方法)-哔哩哔哩1、该软件可以...
wpk俱乐部辅助器!epoke... wpk俱乐部辅助器!epoker底牌透视(透视)app-一贯揭幕真的是有挂所有人都在同一条线上,像星...
透视科普!pokemmo手机版... 透视科普!pokemmo手机版脚本(透视)wepoker私人局透视插件,教程指南书(有挂技巧)-哔哩...
智星德州插件怎么下载!hhpo... 智星德州插件怎么下载!hhpoker德州真的假的(透视)app-本来分享是真的挂1、操作简单,无需智...
透视专业!wepokerplu... 透视专业!wepokerplus辅助(透视)wpk透视是真的吗,教程教材(有挂攻略)-哔哩哔哩1、每...