[英]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 app
的package 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.