Upon starting my Android app, I want to auto start the native camera (can be done using intents) and start taking pictures automatically for every few seconds.
Can this be done? After starting the camera, how do I initiate this? So that user need not click anything to start the photo taking process.
Thanks In Advance,
Perumal
There is no support in the camera intents for autocapture. If you want to do that you'll need to actually implement the camera code within your app.
If you are using intent, you just fire up installed camera application and have no firther control. If you like to capture images periodically and be in control, you have to use camera service yourself. Here (in source repo) you can find a sample how to fire up camera and capture previews:
http://sourceforge.net/projects/javaocr/
Keep the button there but set the visibility to gone so that user doesn't see the button.
When you open the camera, use a timer task and then inside the timer task just write:
button.performClick();
here button is the reference to your Button or whatever view you are using.
This will capture images automatically, after the time specified by you.
Related
Is it possible to use ACTION_IMAGE_CAPTURE and customize some parts of the code? If yes, how?
I would like to add some Toast in the code. I know that there is the method onActivityResult to add some actions at the moment of the end of the activity.
But I would like to add some actions (ig. Toast) in other moments: for example when the user taps the screen to take the picture but before saving the picture.
Write your own camera app, where you provide an activity that implements ACTION_IMAGE_CAPTURE. Then, you can do whatever you want within that activity.
If, instead, you are asking how you can modify the code of hundreds of other camera apps that supply the world's ACTION_IMAGE_CAPTURE implementations, that is not possible.
Also, note that there is no requirement that the user tap the screen to take a picture using a camera app. They might set up a timer in the app, with the picture being taken after the timer elapses. Or, they might press a hardware CAMERA button, or press something on a Bluetooth remote, etc.
I am currently using the default camera to take photos for my app.
It currently displays Retry and OK buttons at the top of the screen when launched, is there any way of adding cancel to this, which would return the user to the app?
No, it is not possible. Since we launch the default camera app with startActivityForResult(), which means you are kind of moving out of the app and seeking Result on completion of task on the CameraIntent. Customizing Camera intent is in not your hand untill Camera app exposes some API to do so(which is not yet available).
I want to develop a custom Android App that use the phone camera to take pictures, but I don't want to see any interface in the app, just run it in background and wait for a default trigger, like push volumen up or down.
Is this possible? Can I run a camera intent in the background?
Any feedback will be appreciated.
In my App I use ACTION_VIDEO_CAPTURE to record video.
But Now I have to start record when I start Activity.
How ro start ACTION_VIDEO_CAPTURE and start recording automatically?
Or if it's impossible how to add listener to record button (ACTION_VIDEO_CAPTURE) or check when this button was clicked?
How ro start ACTION_VIDEO_CAPTURE and start recording automatically?
You don't. There is nothing in the ACTION_VIDEO_CAPTURE protocol that allows you request, let alone control, how the third-party camera app allows the user to start and stop the video.
how to add listener to record button (ACTION_VIDEO_CAPTURE) or check when this button was clicked?
I do not know what "record button" you are referring to. If you are referring to a button in the third-party camera app, there may not be a button. The third-party camera app may use a tap on the preview image, or a gesture, or a timer, or whatever the developer of the third-party camera app wants to do. Moreover, all of that is inside the third-party camera app, and you have no good way of finding out when those events occur, if at all.
If you need this level of control over video recording, record the videos yourself using MediaRecorder.
I want to write application on Android that starts in background when user launches a built-in camera (it is important: build-in camera, not an application) and do some actions after user makes a photo.
Is it real? If yes, how to implement this?
I doubt if this is possible. There is no mechanism which android provides that causes a broadcast to the system that Camera has been launched. Plus, you cannot modify the contents shown on the screen as the Camera application is in command. The only way out is to have a MediaScanner and FileObserver to check when a new picture is created in DCIM/Camera/ folder and make your app act accordingly