I'm working on Android application that capture images and upload this images to a server.
I used intent to open the camera:
val cameraIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
I need to open the camera in landscape orientation, I tried this approach and nothing changed
cameraIntent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
Any advice please.
The behavior of the camera app is up to the developers of the camera app. There are hundreds of camera apps, both pre-installed and user-installed. EXTRA_SCREEN_ORIENTATION is not documented as being part of the ACTION_IMAGE_CAPTURE protocol, and I am not aware of any camera apps that would honor it. There is no requirement for any camera app to let callers force a screen orientation.
You could integrate a camera library (CameraX from Google, etc.) and take photos yourself directly in your app. Then, you would be able to control the orientation of your screen (e.g., via android:screenOrientation in the manifest).
Related
In my app I take a picture by using a Camera intent. When the intent is opening the Samsung default camera app the camera app does not show the photo modes it shows when opening the app directly, like Portrait, Fun, Pro, Panorama, Food etc.
I know that the Intent will open the default camera app, which could be any camera app, but in this LoB app user's mostly have Samsung phones, so is there some "magic" extra information I could pass to the intent so that Samsung's default camera app would show these modes when opened by an intent?
When using ACTION_IMAGE_CAPTURE with android Intent:
val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
intent.putExtra(MediaStore.EXTRA_OUTPUT, it.uri)
intentLauncher.launch(intent)
My app opens camera activity as expected, but it seems to be a dumbed-down version of the original camera app. For example on my Samsung S20+ device, I do not get the ability to scan documents when taking pictures, and if I go into settings of launched activity, Intelligent features are disabled and it says that "Intelligent features only work with the rear camera in Photo mode"
If I use INTENT_ACTION_STILL_IMAGE_CAMERA, then all the intelligent features work, but this mode doesn't return me back to my app after taking a picture.
Is there a way to achieve ACTION_IMAGE_CAPTURE with enabled additional camera features?
I want to develop camera functionality for my app where I have to capture 10 images. The camera should not close, rather it should continuously take pictures while I hold the shutter button. I am using intent for opening the camera, but after taking one image the camera is stopping. How can I achieve the desired functionality?
You would need to write your own camera code, using android.hardware.Camera and/or the android.hardware.camera2.* classes. There is no Intent structure that camera app developers are required to support that handles your use case.
I am new into the android development environment. I want to know if there is a way to overlay an image into the android native camera, so I do not have to program an custom camera, just call the native camera, but into preview an image will be showed. I have tried many ways, but none of them seems to work.
Here is the code I use to shoot the picture and save the image:
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File pictureDirectory = new File(Environment.getExternalStorageDirectory() + "/myPics");
String pictureName = getPictureName();
File imageFile = new File(pictureDirectory, pictureName);
Uri pictureUri = Uri.fromFile(imageFile);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, pictureUri);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
Something like this face grid, but on top of the native camera:
!https://lh6.ggpht.com/8_x6orazogmW3sU9pnev2EzOalJkKi8ext1qzNTbbHdFCP5W0eKdVJk3KnMijf0nQw=h900
Thank You!
I want to know if there is a way to overlay an image into the android native camera, so I do not have to program an custom camera, just call the native camera, but into preview an image will be showed. Something like this face grid, but on top of the native camera
No.
First, there are thousands of Android device models. These devices will have dozens, if not hundreds, of "android native camera" apps, as many device manufacturers frequently ship a customized camera app.
Second, your code is not invoking an "android native camera" app. Your code is invoking the user's choice of what camera app to use, among the camera apps that the user has installed that support ACTION_IMAGE_CAPTURE. The user can easily choose to use some other camera app, if they prefer that camera app to the one that shipped with their device. So now you have hundreds, if not thousands, of additional camera apps to consider. Any of those could be what a given user is using.
Third, there is no requirement that all camera apps have an identical user interface. The size and position of the camera preview can vary. Not only will they vary between apps, but even the same app might vary the size and position of the camera preview between versions of that app, as apps can and do get updated.
Fourth, you have no good way of determining when any of these camera apps happens to be in the foreground.
I need to slightly modify the default camera intent in android - for example I want to start the camera in 360p quality, when starting front camera to be the active one and to be oriented in landscape. I have done a research and find some put extra options that could be used but it seems they do not work properly. So i think that the best way to do this is to find the build in camera intent code and do some modifications.
Where I can find the source of the build in camera intent and also the meta data part in the manifest(if there are some specific options to start the intent)?
I need to slightly modify the default camera intent in android - for example I want to start the camera in 360p quality, when starting front camera to be the active one and to be oriented in landscape.
I am going to guess that by "default camera intent" you mean an Intent for ACTION_IMAGE_CAPTURE.
I have done a research and find some put extra options that could be used but it seems they do not work properly.
For ACTION_IMAGE_CAPTURE, there is no extra to force 360p, and not all cameras support that resolution. There is no extra to force a front-facing camera, and not all devices have a front-facing camera. I am skeptical that EXTRA_SCREEN_ORIENTATION will do what you want, and there is no requirement that any camera app must support EXTRA_SCREEN_ORIENTATION.
So i think that the best way to do this is to find the build in camera intent code and do some modifications.
I am going to assume that by "build in camera intent code" you mean "built-in camera app".
Where I can find the source of the build in camera intent and also the meta data part in the manifest(if there are some specific options to start the intent)?
Few manufacturers ship the AOSP camera app. They replace it with their own. The source code for their own camera apps will be in their offices.