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).
Related
I am using the code below to start an installed camera app (not developed by me) from a background service in an app I'm working on.
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.sec.android.app.camera");
startActivity( launchIntent );
I need to determine if the camera app is done loading and ready to use so I can prompt the camera to take a picture. After the picture is taken, my app will be brought back to the foreground and show a screensaver until the camera is started again or brought back to the foreground to take another picture. Is there a way to verify that the camera app is loaded and ready each time before attempting to send it commands?
For clarity, I'm not asking about how to check this on a camera app specifically. I'm trying to learn how I can start just about any app (not developed by me) and listen for it to be completely loaded and ready.
I am using the code below to start an installed camera app (not developed by me) from a background service
Launching activities from the background is not supported on modern versions of Android.
Also note that many devices will not have that particular package.
I need to determine if the camera app is done loading and ready to use so I can prompt the camera to take a picture
There is no canonical definition of "done loading and ready to use". And, in general, there is no means for you to monitor the operations of another app, for privacy and security reasons.
Also, outside of accessibility services, in general, you have no means of telling a running app to do anything unless it has a specific API for that purpose. Even with accessibility services, I suspect that it will be difficult to come up with an approach that works no matter what the camera app is.
If, from the foreground, you want a camera app to take a picture, use ACTION_IMAGE_CAPTURE. Or, integrate camera functionality directly in your own app, such as via CameraX or other libraries.
The Google glass contains a camera button at the top. By default it invokes the default Google camera app and captures the picture in a single click.
If my app is running, I can receive the camera button pressed event by overriding onKeyDown() in my app.
My question is, how can I make the camera button to start my app at first hand?
Also how does the Google camera app gets started when the camera button is pressed and how is the event again passed to onKeyDown()?
There is currently no way for a Glassware other than the built-in Camera to get started when the camera button is pressed on the timeline.
If you would like such a feature, please file a feature request in our issues tracker and explain your use-case so we can properly triage and prioritize.
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
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.
I am trying to take multiple photos using the default device camera application launched through an intent (MediaStore.ACTION_IMAGE_CAPTURE). With the devices I am testing with, the camera launches, takes a picture, asks for confirmation, then returns to my activity where I process the result.
I've considered using broadcast receiver callbacks or a content observer; however, I cannot find a way to launch the camera and keep it active until the user is finished. If possible, I wish to avoid developing a custom camera application.
The reason I must do this is because users commonly need to take multiple photos in succession, and on some devices the camera start-up time is upwards of 5 seconds, and the users using the software take 10 - 30 photos consecutively; not only that, but they need control over various camera parameters.
Is there a way to launch the camera intent and only return to my activity once the user exits the camera application?
I discovered through the SDK documentation that there's an alternative intent action for the device camera that launches the camera in still image mode and does not exit until the user is finished with the activity:
Intent intent = new Intent(
MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
this.startActivity(intent);
Coupled with a ContentObserver this was exactly what I needed to accomplish.