简体   繁体   English

在 Android 管理 API 策略中启用设备的相机应用程序

[英]Enable Device's Camera App in Android Management API Policy

My app calls the device's camera app using:我的应用程序使用以下方法调用设备的相机应用程序:

Intent pictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);


    if (pictureIntent.resolveActivity(getPackageManager()) != null) {

        File file = null;
        try {
            file = createImageFile();
            Log.d(TAG, "created imagefile ");
        } catch (IOException e) {
            e.printStackTrace();
            return;
        }
        Uri photoUri = FileProvider.getUriForFile(this, getPackageName() + ".provider", file);
        Log.d(TAG, "openCamera: " + photoUri);
        pictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);


        startActivityForResult(pictureIntent, MY_PERMISSIONS_REQUEST_CAMERA);
    }

When using the app in a provisioned device with "cameraDisabled": false I still cannot load the camera.在具有 "cameraDisabled": false 的预配设备中使用该应用程序时,我仍然无法加载相机。

My policy is:我的政策是:

{ "applications": [{ "packageName": "**************", "installType": "FORCE_INSTALLED", "defaultPermissionPolicy": "GRANT" }], "debuggingFeaturesAllowed": true, "addUserDisabled": true, "adjustVolumeDisabled": true, "outgoingCallsDisabled": true, "locationMode": "HIGH_ACCURACY", "cameraDisabled": false, "screenCaptureDisabled": true, "defaultPermissionPolicy": "GRANT", "wifiConfigDisabled": false, "dataRoamingDisabled": false, "smsDisabled": true, "factoryResetDisabled": false, "uninstallAppsDisabled": true, "tetheringConfigDisabled": true, "shareLocationDisabled": false, "funDisabled": true, "appAutoUpdatePolicy": "WIFI_ONLY", "systemUpdate": { "type": "WINDOWED", "startMinutes": 10, "endMinutes": 1430 }, "kioskCustomLauncherEnabled":true, "kioskCustomization": { "deviceSettings": "SETTINGS_ACCESS_ALLOWED" } } { "applications": [{ "packageName": "**************", "installType": "FORCE_INSTALLED", "defaultPermissionPolicy": "GRANT" }], "debuggingFeaturesAllowed":真,“addUserDisabled”:真,“adjustVolumeDisabled”:真,“outgoingCallsDisabled”:真,“locationMode”:“HIGH_ACCURACY”,“cameraDisabled”:假,“screenCaptureDisabled”:真,“defaultPermissionPolicy”:“GRANT”,“wifiConfigDisabled” ": false, "dataRoamingDisabled": false, "smsDisabled": true, "factoryResetDisabled": false, "uninstallAppsDisabled": true, "tetheringConfigDisabled": true, "shareLocationDisabled": false, "funDisabled": true, "appAutoUpdatePolicy": "WIFI_ONLY", "systemUpdate": { "type": "WINDOWED", "startMinutes": 10, "endMinutes": 1430 }, "kioskCustomLauncherEnabled":true, "kioskCustomization": { "deviceSettings": "SETTINGS_ACCESS_ALLOWED" } }

UPDATE: I ended up using the the CameraX library to create my own camera instead.更新:我最终使用 CameraX 库来创建我自己的相机。

You would have probably disabled system apps during enrollment in the QR code.您可能会在 QR 码注册期间禁用系统应用程序。

Now for your question, you will have to find the package name of the default camera app of the device and just enable it in the policy.现在对于您的问题,您必须找到设备default camera apppackage name ,然后在策略中启用它。

For example, Snapdragon Camera is the default on my Zebra devices :例如,Snapdragon 相机是我的 Zebra 设备上的默认设置:

  "applications": [
    {
      "packageName": "org.codeaurora.snapcam",
      "installType": "FORCE_INSTALLED"
    }
  ]
}

I know the camera app would be different for each device brand but with system apps disabled, this is the way that I've been using.我知道每个设备品牌的相机应用程序会有所不同,但是在禁用系统应用程序的情况下,这是我一直在使用的方式。

暂无
暂无

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

相关问题 Android 管理 API 更改设备策略 - Android Management API change Policy for device Android Management api - 是否可以在 android 应用程序中获取设备 ID/名称? (设备特定的 QR 是不可能的,生成策略特定的 - Android Management api - Is it possible to get device id/name in android app? ( Device specific QR is not possible, Generating Policy specific Android Management API permissionGrants 在策略应用程序中未反映在设备上 - Android Management API permissionGrants in policy applications not reflecting on device 在通过 android 管理 api 控制的完全托管设备中启用内部应用程序共享 - Enable Internal app sharing in fully managed device controlled through android management api Android 管理 API 补丁后设备同步策略的最长时间 - Android Management API Maximum time for device to sync policy after patch Android Management API 禁用相机,自定义应用除外 - Android Management API Disable Camera Except For Custom App 使用Android Management API启用蓝牙 - Enable bluetooth with Android Management API 通过Android Management Api或设备所有者锁定任务开发Cosu应用程序 - Cosu app development through Android Management Api or device owner locktask 在完全托管的设备中默认启用相机和计算器等系统应用程序 android 管理 api - enable system apps like camera and calculator by default in fully managed devices android management api android-management-api - 已安装的应用程序未反映在设备 Object 中。仅在 Android 设备策略中同步后反映 - android-management-api - Installed Application is not reflecting in Device Object .only reflected after giving sync in Android device Policy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM