2017-05-30 21 views
1

我有几个设备通过NFC提供设备所有者权限,没有涉及EMM,所有策略都由我的DPC设置在供应期间下载。此时我不设置Google帐户。通过NFC的设备所有者应用程序/电话可以完全访问Play商店(而不是Play for Work)

手动添加Google帐户后,所有设备都可以访问Google Play Store工作应用(目前仅包含Google Apps应用),但不能访问常规Play商店。

有没有办法阻止设备访问Work Apps Play Store并授予他们完全访问权限?如果可能,我想不管理帐户,而只是做一些事情,例如不允许工厂重置和更改WiFi,电话,短信等等......

这些是我用DPC设置的策略,也许我是误解他们中的一些人做什么?

public static void setDefaultPolicies(Context context, boolean active) { 
    ComponentName componentName = DeviceAdminReceiver.getComponentName(context); 

    DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(DEVICE_POLICY_SERVICE); 

    setUserRestriction(dpm, componentName, UserManager.DISALLOW_FACTORY_RESET, active); 

    setUserRestriction(dpm, componentName, UserManager.DISALLOW_ADD_USER, active); 
    setUserRestriction(dpm, componentName, UserManager.DISALLOW_REMOVE_USER, active); 
    setUserRestriction(dpm, componentName, UserManager.DISALLOW_MOUNT_PHYSICAL_MEDIA, active); 
    //setUserRestriction(dpm, componentName, UserManager.DISALLOW_ADJUST_VOLUME, active); 

    //no disabling of wifi and stuff. 
    setUserRestriction(dpm, componentName, UserManager.DISALLOW_CONFIG_WIFI, active); 
    setUserRestriction(dpm, componentName, UserManager.DISALLOW_NETWORK_RESET, active); 
    //setUserRestriction(dpm, componentName, UserManager.DISALLOW_); 

    setUserRestriction(dpm, componentName, UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, active); 


    //no calls and sms. 
    setUserRestriction(dpm, componentName, UserManager.DISALLOW_SMS, active); 
    setUserRestriction(dpm, componentName, UserManager.DISALLOW_OUTGOING_CALLS, active); 


    // set System Update policy 
     if (active) { 
     dpm.setSystemUpdatePolicy(componentName, 
       SystemUpdatePolicy.createWindowedInstallPolicy(60, 120)); 
    } else { 
     dpm.setSystemUpdatePolicy(componentName, null); 
    } 

    // set this Activity as a lock task package 

    // dpm.setLockTaskPackages(componentName, 
    //  active ? new String[]{context.getPackageName()} : new String[]{}); 

    IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MAIN); 
    intentFilter.addCategory(Intent.CATEGORY_HOME); 
    intentFilter.addCategory(Intent.CATEGORY_DEFAULT); 

    if (active) { 
     // set app as home intent receiver so that it is started 
     // on reboot 
     dpm.addPersistentPreferredActivity(
       componentName, intentFilter, new ComponentName(
         context.getPackageName(), MainActivity.class.getName())); 
    } else { 
     dpm.clearPackagePersistentPreferredActivities(
       componentName, context.getPackageName()); 
    } 
} 

private static void setUserRestriction(DevicePolicyManager dpm, ComponentName componentName, String restriction, boolean disallow) { 
    if (disallow) { 
     dpm.addUserRestriction(componentName, 
       restriction); 
    } else { 
     dpm.clearUserRestriction(componentName, 
       restriction); 
    } 
} 

I know it's possible to grant users access to Play Store apps via the EMM Api,但是我不能使用EMM。

回答

1

当我将一个普通的Google帐户添加到我的设备(它也与设备所有者一起配置)时,我可以获得常规的完全访问Play商店。

我不认为问题出在您的设备所有者应用上,而是您添加的Google帐户的类型。您提到“Google Apps应用”,这是否意味着您要添加GSuite Google帐户?

我使用GSuite Google帐户做了一个快速测试,我遇到了和你一样的结果。

你有几个选项,也许更多。 GSuite和EMM一般来说设置起来很复杂。

1)如果您作为GSuite帐户的超级管理员登录到https://admin.google.com,则可以将Google移动管理添加为EMM,并从那里添加白名单应用。可能需要很多工作。

2)这是最快和最简单的。添加另一个普通的Google帐户,然后使用这个新帐户登录Play商店。您应该可以完全访问Play商店。

+0

您说得对,我使用的是非托管G Suite帐户,但在拥有设备所有者的设备上登录显然会开始管理这种情况。您的第二个建议对我来说是一个很好的解决方案,另外我可以不使用G Suite帐户作为第三个解决方案。谢谢。 – Syzygy

相关问题