Unfortunately, when using a camera with Intent, the only additional option you can set is
MediaStore.EXTRA_OUTPUT
For example,
fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a file to save the image intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
Lets you match where the camera application will save the image.
Sometimes itβs possible to work with the Camera Image object:
action.putExtra("android.intent.extras.CAMERA_FACING", 1);
There are some βtestβ methods in the Android source files that are in the Util class file but are not officially documented:
(Util)
private static final String EXTRAS_CAMERA_FACING = "android.intent.extras.CAMERA_FACING"; // This is for test only. Allow the camera to launch the specific camera. public static int getCameraFacingIntentExtras(Activity currentActivity) { int cameraId = -1; int intentCameraId = currentActivity.getIntent().getIntExtra(Util.EXTRAS_CAMERA_FACING, -1); if (isFrontCameraIntent(intentCameraId)) { // Check if the front camera exist int frontCameraId = CameraHolder.instance().getFrontCameraId(); if (frontCameraId != -1) { cameraId = frontCameraId; } } else if (isBackCameraIntent(intentCameraId)) { // Check if the back camera exist int backCameraId = CameraHolder.instance().getBackCameraId(); if (backCameraId != -1) { cameraId = backCameraId; } } return cameraId; }
And in the photomodule the following method is used:
(photo module)
private int getPreferredCameraId(ComboPreferences preferences) { int intentCameraId = Util.getCameraFacingIntentExtras(mActivity); if (intentCameraId != -1) {
And when the camera application initializes the photo mode, it calls this method to check which camera to use:
mCameraId = getPreferredCameraId(mPreferences);
frogmanx
source share