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.
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" } }
UPDATE: I ended up using the the CameraX library to create my own camera instead.