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.
Related
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.
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.
In my application, i want to take picture using built-in camera application. Taking picture process is working fine. I want to know is picture taken from front camera or back camera, because after taking picture i want to get the rotation angle and rotate the picture to that angle and store it in sdcard. ExifInterface always return the same angle(90) rather user take the picture from front/back camera. When user take the picture from back camera, rotation is fine but when user take the picture from front camera, picture rotation is wrong. Please suggest any solution for this problem.
Thanks
I believe that your device does something wrong with the rotation flag. You should try other devices, too.
Note that MediaStore.ACTION_IMAGE_CAPTURE may be fulfilled by different Camera apps on different devices, or even on the same device: the end user is free to choose. Some downloaded applications will respect an extra to choose the front camera (see https://stackoverflow.com/a/11159760/192373), other won't. Some will do a better job to provide correct EXIF, others will mess it up.
I wish to use the front camera of a device to capture the image without any preview and the screen to remain blank.
I have a way to remotely activate this but not sure how to do it.
I found this: https://stackoverflow.com/questions/10702906/showing-blank-screen-while-recording-video-in-motorola-attrix-2-with-android-2-2.
It is pretty close to what I want but I'm not sure how to use the code and change it to camera.
When the Android camera opens it fills up the screen in width and height but actually I want the app to open and limit upto certain dimensions on the screen aka BarCode Scanner but here the catch is that the image taken should limit the boundary of the rectangle that the app shows on its surface.
Is this possible?
First: That app is open-source, so feel free to check what they are doing:
Project on google code
If i had a guess I'd say they overlay the camera preview with another view (e.g. via addContentView()) and crop the camera-/previewimage after the image callback.
So this is definitely possible, you have to crop the image manually though (according to the frame).