Avoiding having to create a whole camera app myself, I am calling up:
Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
this.startActivityForResult(camera, PICTURE_RESULT);
However, the camera is very advanced and beautiful :) but not for my purposes. :(
Is there a way to restrict the camera to control size, resolution, disable setup button, flash, face recognition, etc...?
Sorry but you will be unable to change all these features using the Intents system. For this level of control you will have to create you own camera program.
http://developer.android.com/reference/android/hardware/Camera.html
You can change the autofocus and flash however using the uses tag in the manifest.xml
Related
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).
I'm developing an app on Android Studio and I am setting a button that, when pressed, will open the camera. In particular, I need the camera to take multiple shots (keeping the "shot" button pressed on the camera view, it should take multiple shots till it is released).
My smartphone camera supports the "continuous shot" feature (Android 5.1, API 22), but I cannot use it when I call the camera from my app. As you can see in the screenshots below, when I open the camera from the official camera app, it has a different layout with more settings. When I call the camera from my app, it has less settings and if I try to keep pressed the "shot" button, it appears the toast message "Does not support continuous shot".
https://i.imgur.com/ncaJYyz.jpg
https://i.imgur.com/IJMIqjf.jpg
The simple code I use to call the camera function in my app is the following:
public void cameraCall(View view) {
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 0);
}
Any idea about how to solve this problem?
Thank you
When you use IMAGE_CAPTURE intent, Android launches some camera app on your device. Most often, this will be the Camera app that was preinstalled by the device manufacturer, but this could be an 3rd party app installed from the Play Store or even sideloaded. This Camera app declared support for this standard intent, and hopefully it honestly fulfills the contract defined for this standard intent. This contract does not mention many advanced features of the cameras, so most likely you will not get them.
You may find another intent, INTENT_ACTION_STILL_IMAGE_CAMERA, better fit your needs. Or you can launch default camera app on press of the button.
The alternative is to implement custom camera in your app.
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 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.
I am developing an application where I have to take picture without using Media intent i-e without previewing this camera.How can I do this can anyone help me in this regard.
waiting for your reply
Altaf
You cannot take a picture without a preview. Whether it is the preview offered by the Intent or it is a preview that you create yourself with a SurfaceView when you use the Camera object, there has to be a preview.
Just use takePicture() directly on the camera object:
http://developer.android.com/reference/android/hardware/Camera.html#takePicture
I believe some of the older devices wouldn't capture correctly unless preview was setup, but I don't think that's an issue any more. And if you are looking to target devices that require preview you can just resize the preview surface to a single pixel somewhere and put another control on top of it. Still eats resources, but shouldn't be visible.