How can I launch to the device camera, in built-in countdown mode, configure it to 10s and take a photo?
Without user interaction.
The user should not press the capture button. It should start programmatically.
Thanks.
First, the "device camera" does not necessarily have a "built-in countdown mode". There are thousands of Android device models, with dozens (if not hundreds) of pre-installed camera apps. None have to have this feature. Similarly, there are hundreds of camera apps available on the Play Store, and none of them have to have this feature.
Second, even if a camera app has this feature, there is no requirement that it expose an API for third-party developers to invoke this feature.
Third, even if a camera app has this feature and exposes an API for it, there is no standards for this API.
You are welcome to contact the developers of various camera apps and see if they have the feature and, if so, if they have an API for third-party developers to invoke it.
Related
The TL;DR is I want to upload photos to a web form that aren't purely photos. In this specific case it would be an image from a Thermal Camera App that has its own physical accessory.
So this screen would list the Thermal Cam app as well.
Currently I cannot set it as the "Default Camera" application even though it does take pictures. Can I do anything to change that?
I am speaking as a tech-savvy user making educated guesses, not a developer.
Phone is a Samsung J7, Version 7.1.1 if it matters.
No
The app needs to support the Camera Intent Filters which would require the app developer to support all of the ways to pass back an image.
What can you do
Ask the publisher/developer of Thermal Camera App to support Camera Intents.
Our app runs as a background service, continuously getting the images from the frontal camera and then doing things with the images. However, when the user tries to open another app that uses the camera, two things happen: either the new app crashes and ours continues, or our crashes and the new one gets access to the camera.
Now, if our app loses control over the camera, there's an exception that we can catch, and we can then start trying to access it until we get access and things go back to normal.
The problem is when the other apps crash because of ours. Is there any way to detect this, so we can pause our app until we can access the camera again?
This happens because camera is an exclusive resource.
I recommend you to read the Camera documentation, which says:
If your application does not properly release the camera, all
subsequent attempts to access the camera, including those by your own
application, will fail and may cause your or other applications to be
shut down.
Unfortunately, Camera API or Android SDK in general don't provide this kind of info. The good news is that gradually, more new devices let you open the front-facing and the rear-facing cameras independently. This could reduce the probability of a clash.
From your description, it may be legitimate to crash the applications that compete with yours over access to camera, but, jokes aside, there is nothing you can do about it. It's their fault that they don't check the RuntimeException correctly.
Android has recently tightened the isolation between apps, so it may be impossible to track which applications are started (see App to monitor other apps on android), unless your app has system privileges.
My app is taking pictures with the native android camera. With my Motorola X 2, everything is going fine when the intent is launching. I can change settings, luminosity, HDR option etc.
I installed the same application on a Nexus 5 (Android 6.0.1). I started the application and then the camera intent. The device won't allow to change the HDR settings. Otherwise, in the native camera application, I can change these settings.
Is there a way to enable programmatically the HDR option on the camera before starting the intent ?
Or another way to fix it ?
Is there a way to enable programmatically the HDR option on the camera before starting the intent ?
No.
Or another way to fix it ?
Take the pictures yourself, using the camera APIs. Note that this is rather complex.
Right now, you are delegating to a third-party camera application. There are over 8000 Android device models. There will be hundreds of different pre-installed camera apps across those models, plus many more that users install from the Play Store or elsewhere. None of them have to offer HDR control to the user. None of them have to offer you the ability to request a particular HDR setting. And your app could wind up requesting any of those, based upon device and user.
In your case, on one of your devices, one of the hundreds of camera apps happens to offer HDR control when launched normally and not offer HDR control when launched via ACTION_IMAGE_CAPTURE (or whatever other Intent action that you are using). Either the developers of that camera app chose that behavior intentionally, or they have a bug in their app. Regardless, there is nothing that you can do about it.
I wanted to know if it was possible for an app to know if user took a photo with the Android camera and send a push notification or start the app if it is activated.
There are ~1.5 billion Android devices in use, spanning thousands of device models. These will have hundreds, if not thousands, of "Android camera apps", including pre-installed ones and ones installed by users. None have to tell third-party apps when they take a picture, and none have to publish any evidence that they took a picture. For example, they can take a picture and upload it straight to a Web server.
So, no, this is not possible in any reliable fashion.
I want to be able to access an external camera such as a GoPro from the Google Hangouts App for Android. Currently the app allows you to use either your front or rear facing camera. I would like to be able to select a wifi or bluetooth paired adventure camera. Is there a way to create an app that will interact with Androids camera APIs and the Hangouts app to allow this?
No, you cannot create an app that provides new Cameras to other applications.
The cameras available to your application are determined by the firmware on the device. If you create a custom ROM you might be able to get your own cameras to work with applications, but I am guessing that the Hangouts app will still not support it.
The Hangouts app is likely hard coded to only support front and back facing cameras, and thus would not show any additional cameras available to the user.