How can I use the 'enter' hardware button to take a picture when the camera app is open on Zebra MC2700

// Expert user has replied.
C Christoforos Vlachos 1 year 5 months ago
60 3 0

I am currently developing an Android app using Kotlin which will be running on Zebra MC2700 devices. As part of the functionality of the app, I have implemented a feature where the camera opens to capture images.

However, I would like to make use of the 'enter' hardware button on the device to trigger the camera capture when the camera app is open. I would like to seek the guidance of the community on how I can achieve this functionality.

Could anyone please provide me with the necessary technical information or documentation that I would require to integrate this functionality into my app?

Thank you very much in advance

Please Register or Login to post a reply

3 Replies

J James Swinton-Bland

Hi,

You can use our KeyMapping feature the remap the enter key to launch the camera app via an intent: https://techdocs.zebra.com/mx/keymappingmgr/

Alternatively you could implement a KeyListener in your application to listen for the enter key, and then trigger the camera app yourself, which may give a bit more control.

Thanks,

James

C Christoforos Vlachos

Hi James, 

First of all, thank you for your quick response. Basically when the user presses the enter key, the below code is called:

val cameraIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
cameraIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
cameraIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri)
startActivityForResult(
    cameraIntent,
    REQUEST_CODE_CAMERA
)

At this point the camera is already open. What I would like to achieve is to  implement a KeyListener to trigger the button of the camera app which takes a picture (kindly see the image below).  Is this possible ?

 

Thank you in advance,

Chris

J James Swinton-Bland

Hi Chris,

Apologies, I misread your initial question - thanks for the explanation.

There is no way to trigger the camera capture programmatically w/ the default camera app, as far as I'm aware. There may be some 3rd party apps that include an API for triggering camera capture via, for example, an intent, which could then be mapped to the enter key but I don't have any specific recommendations.

Thanks,

James

CONTACT
Can’t find what you’re looking for?