Zebra scanner emdk integration - android

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

Related

Android Studio - Camera Burst (Multiple shots)

I'm developing an app on Android Studio and I am setting a button that, when pressed, will open the camera. In particular, I need the camera to take multiple shots (keeping the "shot" button pressed on the camera view, it should take multiple shots till it is released).
My smartphone camera supports the "continuous shot" feature (Android 5.1, API 22), but I cannot use it when I call the camera from my app. As you can see in the screenshots below, when I open the camera from the official camera app, it has a different layout with more settings. When I call the camera from my app, it has less settings and if I try to keep pressed the "shot" button, it appears the toast message "Does not support continuous shot".
https://i.imgur.com/ncaJYyz.jpg
https://i.imgur.com/IJMIqjf.jpg
The simple code I use to call the camera function in my app is the following:
public void cameraCall(View view) {
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 0);
}
Any idea about how to solve this problem?
Thank you
When you use IMAGE_CAPTURE intent, Android launches some camera app on your device. Most often, this will be the Camera app that was preinstalled by the device manufacturer, but this could be an 3rd party app installed from the Play Store or even sideloaded. This Camera app declared support for this standard intent, and hopefully it honestly fulfills the contract defined for this standard intent. This contract does not mention many advanced features of the cameras, so most likely you will not get them.
You may find another intent, INTENT_ACTION_STILL_IMAGE_CAMERA, better fit your needs. Or you can launch default camera app on press of the button.
The alternative is to implement custom camera in your app.

Enabling Camera LED alone without Camera.open in 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.

Is there a way to remove the pause button from the custom camera view in Android?

I am building an Android app that uses the phone's camera feature. I know there is a way to build a custom camera view. Instead, I am choosing to use the camera app via an intent and not build my own camera view. I want to disable/make disappear the pause button while taking a video and have just the stop button. I looked up the Camera API Guide at www.developer.android.com but it doesn't talk about how I could do this. Does anyone know a way to do this?
I doesn't think that this is possible. Using Intents is just a way to tell Android "hey, I'd like to take a video (photo, see MapView, etc). Can you do it for me?". It may trigger one or MORE Apps listening to that Intent, depending on what apps the user has Installed. Usually you can only choose very basic options via Intents, i.e. take video/picture or tell the MapView at which Position it should show up. These options usually also appear inside the App during normal use. I never see a "CustomCamera-App" that hasn't a pause Button, or where one is able to deactivate it inside the menu. Therefore the chances that it is possible to set that special option tends to zero.

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.

Android Camera continuous focus

I need to implement an app on android which uses the camera and it needs to keep the focus continuously on objects. Whenever user changes the camera position, it should autofocus itself for that position (very much like Google Goggles).
Right now I am using the following code:
camera.requestautofocus(autofocuscallbak);
This works well but it's not continuous...
You can use the option: http://developer.android.com/reference/android/hardware/Camera.Parameters.html#FOCUS_MODE_CONTINUOUS_VIDEO
Or you can take a look a the Zxing library http://code.google.com/p/zxing/ (barcode scanner app) which has a loop of events build which comes close to continuous autofocus.
It is heavier on your device than you would want to though.
Probably a nicer solution would be to write a function yourself using the accelerometer, and triggering the autofocus when the phone has moved (too much) in a certain direction.

Categories

Resources