设备所有者 App/Phone 通过 NFC 访问 Play 商店(而不是 Play for Work)

Device Owner App/Phone via NFC with full access to Play Store (instead of Play for Work)

我有几台设备通过 NFC 配置了设备所有者权限,不涉及 EMM,所有策略均由我的 DPC 设置,在配置过程中下载。此时我没有设置google帐户。

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

有什么方法可以停止将设备限制为 Work Apps Play 商店并改为授予他们完全访问权限?如果可能的话,我不想管理帐户,而是只做一些事情,比如不允许恢复出厂设置和更改 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。

当我向我的设备添加一个正常的 google 帐户时(它也由设备所有者提供),我得到了常规的、完全访问的 Play 商店。

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

我使用 GSuite Google 帐户进行了快速测试,结果与您相同。

您有几个选择,也许更多。 GSuite 和 EMM 通常设置起来很复杂。

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

2) 这是最快最简单的。添加另一个正常的 Google 帐户并使用这个新帐户登录 Play 商店。您应该可以完全访问 Play 商店。