我的应用程序使用以下方法调用设备的相机应用程序:
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);
}
在具有 "cameraDisabled": false 的预配设备中使用该应用程序时,我仍然无法加载相机。
我的政策是:
{ "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 " } }
更新:我最终使用 CameraX 库来创建我自己的相机。
您可能会在 QR 码注册期间禁用系统应用程序。
现在对于你的问题,你必须找到package name
的default camera app
设备的,只是启用它的政策英寸
例如,Snapdragon 相机是我的 Zebra 设备上的默认设置:
"applications": [
{
"packageName": "org.codeaurora.snapcam",
"installType": "FORCE_INSTALLED"
}
]
}
我知道每个设备品牌的相机应用程序会有所不同,但是在禁用系统应用程序的情况下,这是我一直在使用的方式。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句