Press Default Camera App Capture button programatically like in selfie stick Android - android

i am making an app in which i want to capture image in default camera app without pressing capture button.i also tired this but it just open camera app.
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

i am making an app in which i want to capture image in default camera app without pressing capture button
That is impractical, sorry.
First, there is no single "default camera app". There are ~2 billion Android devices in use, spanning thousands of models. Those models ship with hundreds of "default camera apps".
Second, there is no requirement for a camera app to have a capture button. Some might take a picture by other means. Even for those that have a capture button, there is no requirement for it to have anything in common with capture buttons in other camera apps.
Third, outside of accessibility services and rooted devices, an app cannot fake user input into another app.
You are welcome to write your own camera app, using the camera APIs (android.hardware.Camera, android.hardware.camera2.*), and come up with your own trigger for when a picture should be taken.

Related

Can I read the opened camera intent from my so

I built a face detection app that is working fine, the user can:
open the camera intent
take a picture
then it will screen this picture and tell if there is a face in it or no.
My idea is I don't need the user to open the camera from my app I need the user to open the camera
app in Android as normal, and then I will be working in the background reading the picture had been taken by his camera, analyse it and till by a toast if a face had been detected or no.
Not sure about if my application can detect if the camera had been opened or no and if opened can detect if phot had been taken or no, and if yes, can I read this image or no!!
If yes, how?!
Not sure about if my application can detect if the camera had been opened or no
Not really. You cannot detect what apps are in the foreground on modern versions of Android, for privacy and security reasons. And, even if you could, there are hundreds (perhaps thousands) of camera apps. You would have no reliable way of knowing whether any given app is really a camera app.
if opened can detect if phot had been taken or no
Not really. There is no requirement for a camera app to put its images anywhere that your app can access it. And, there is no reliable way to know whether any given file is a photo or not.

Android Studio - Camera Burst (Multiple shots)

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.

Android ACTION_IMAGE_CAPTURE auto focus on take picture

We were using Camera API for our custom camera application. However, it turned out to be a very hard problem. Many devices required extra testing as they seemed to perform unexpected behaviors. So, we have decided to migrate to Android's camera intent.
However, we are dealing with image retrieval tasks so, we don't want our users to send us blurry pictures. Previously, we were using autofocus as user taps on take picture button. Android camera intent performs worse than ours because it does not try to autofocus just before taking the picture. Android's camera does have such option but we don't want leave that decision up to our users because, they will probably will not select that option.
Is it possible to launch the camera intent with the option which auto focusses just before taking the picture? Thank you!
Is it possible to launch the camera intent with the option which auto focusses just before taking the picture?
No. The decision of whether or not to use auto-focus, or a flash, or any other camera feature, is between the user and the developers of the camera app. You do not get a vote.

How do I capture all images from camera with android app running in background?

I know how to make a preview and capture images inside an app.
However, I want to make a "capture mode". In this mode, the user may close my app and any pictures that get taken in other apps such as the default camera app get sent to my app, so I can make a gallery of them in my app.
I have an app which has a button that switches capture mode on and off, but how do I make it listen to camera events happening elsewhere? Would I have to search through the gallery for pictures taken in the time frame that capture mode was on?
Check out http://developer.android.com/reference/android/provider/MediaStore.Images.Media.html to find images located on the phone's internal or external storage during a specific time frame.
If you are doing any sort of work on these images, you could also investigate using a Service to ensure that your app can process the images while the other apps are running, but this hopefully won't be necessary.

Hint user to flip device when taking a Picture

In a part of an app I'm building the user should take an image / pick one from the gallery. The thing is, the image must be oriented horizontally. I would like to show the user a hint on-screen to flip his device if he is holding it in portarit, like google is doing in their new camera app (only in video mode, though)
Is it possible to do this without creating my own camera activity? I'm currently using ACTION_IMAGE_CAPTURE intent to open the default camera.
Eventually, I've built my own camera application which detects rotation and hints the user to rotate the device if it's in portrait mode.

Categories

Resources