Enabling Camera LED alone without Camera.open in Android? - android

Is it possible to enable only LED of the device without using Camera.open() in Android?
Since LED light is also a separate hardware in mobile, there should be way to access it alone without using Camera.open() and setting Torch parameter to it.
The reason why I am asking is I have a Video App which is built in AIR which requires Flash to enabled with Camera also. The Camera will be made open by AIR and Flash will be enabled using Android Native extension. But its not working as we cannot have multiple camera instance opened at the same time.

No, you need to open the Camera with Camera.open() and then setFlashMode() to FLASH_MODE_TORCH to enable the LED light continuously. The LED is supposed to go off when the Camera is closed. And you need to close the Camera when your process goes into the background. So you really can't do this in a second app.
How about using ANE to call setFlashMode()? That would really be the right way to do it. I have never tried it directly so do not know if there's a catch that stops it from working.

Related

Zebra scanner emdk integration

I am adding zebra scanning sdk to my app. I see that when camera is open, the hardware scanner does not work. I have implemented Scanner.StatusListener but I see that this is not invoked when camera is open. I am seeing a way to know when user clicks the hardware button when camera is open to show them a toast. How can I get that callback
Unfortunately it is not possible to use both the camera and the scanner within the same app because of a low level hardware dependency (even if you are using the 2D imager for scanning, rather than the camera, this hardware dependency exists). There is no easy way to programmatically determine that the user has pressed the trigger in this scenario, to display the toast as you say, the only way I can think of would be for your app to remap the trigger to some other action using the KeyMapping Manager and then revert the trigger back to its original behaviour when the camera is dismissed. Rather than try to manage the EMDK enabling & disabling when the camera is used I would recommend using DataWedge for scanning in your app, you still can't do scanning when the camera is displayed but it should make your application logic simpler

How to capture images in background using Camera2 api?

I am developing an Android security app, and I want to capture images in background without preview. Is it possible to capture images in the background using the camera2 api?
Yes, but as of Android 5.0 Marshmallow, you may be disconnected from the camera at any time, if a foreground app wants to use it instead.
And before Android M, using the camera from the background is not recommended, since you'll block any foreground app from using it (the app will just get an error trying to open the camera, and generally will crash as a result).
Otherwise, the camera API works the same. You'll need to run the camera for a few seconds before taking the final picture to ensure metering and focus are generally good, though exactly what you need would depend highly on the details of your use case.

Adobe air android/ios, how to limit captured video length?

I have been searching but have found no information on this. I am working on an app that captures video from the device camera and I would like to limit the length to one minute or less. I have seen the camera API which allows monitoring the status, but even that does not seem to have options for reading the current state (recording or not) Either way the API says to use cameraUI API for mobile, and that has no options other than to lock into video rather than stills.
I also found an ANE for iOS which allows record start/stop functions, so I could use that to make my own record button and implement a timer before triggering stop. but I cannot find an android equivalent.
I am using Flash Professional CS6, not Flex or Flash Builder.
Has anyone done this or have any ideas how to make this happen?

Is it possible to process the video (preview) stream without displaying it on the screen in android?

I have doing a basic object detection on the camera preview screen in Android (greater than 3.2). For the devices which do not support processing on preview screen, I am buffering the preview screen, processing it and clearing the buffer. This part is working as desired.
What I now want is this app to run in the background while any other app is running in the foreground. I am using android service and am able to run a small test app in the background. However my concern is with the camera preview app.
I don't want to display the preview screen but use the preview screen information for processing. This might be too much to ask, but I wanted to know if this is even possible. I came across this link which shows some hope. Basically I want to process the video (preview) stream without displaying it on the screen. If this is doable, then I can think of putting this app in the background and some other app in the foreground.
Unfortunately I won't be able to share the code, however it is the standard logic of creating a surface view and starting the preview.
I would really appreciate any insight into this.
Check comments here.Basically he opens camera hardware, set preview callback and do startpreview without setting the previewDisplay (this might not work on every device). You can try this from your background service. All this will work if your foreground doesn't access the camera app. Please update this if it works. I am interested to know.

Can I control the flashlight without using android.hardware.Camera?

The use of front light option with zxing1.6 barcode scanner does not work on my Nexus One. I need to be able to use the flashlight in my app, but you can't have two instances of the camera running. Is there a way to use the flashlight without accessing the camera? Or can I somehow access a camera that is already in use?
I am using the Google IntentIntegrator.java patch to be able to scan barcodes.
The short answer is "no"; the front LED is controlled as a flash mode, which is a property of the camera. It is mode "torch". And no two apps can't open the camera at the same time.
(A longer answer is that there used to be a hidden API for this, which is what Barcode Scanner tries to access, but it doesn't work on almost any device anymore. You can dig into the source code to see FlashlightManager.)
Since Android 2.x there is this proper API for turning on the light, and the beta of the next version of Barcode Scanner does use it. You can try it here.

Categories

Resources