Block hardware camera shutter / capture button Samsung Galaxy Camera on EK-GC200

591 views Asked by At

I want to use my own camera modul at the Samsung Galaxy Camera EK-GC200. I can get a keycode for both buttons, but capture button always opens his own camera intent which then of course collapes with my own camera modul. Also zoom buttons always show some slide-popup when used.

Meanwhile I found some topics that some people were able to block the HOME button on their devices. But seems this is not usable for the camera buttons.

So is there any way to block the hardware buttons so at least the camera capture button doesn't open its own camera intent anymore ?

1

There are 1 answers

0
Ivo Renkema On

In your MainActivity.java (or some other activity), paste the following:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {

    Log.e(TAG, "keyCode: " + keyCode); // If you want to see the keycodes

    // If User hits the (physical) shutter button of the EK-GC200 camera
    if (KeyEvent.KEYCODE_FOCUS == keyCode || KeyEvent.KEYCODE_CAMERA == keyCode) {
        // Do nothing or start your own camera App
        return true;
    }

    return super.onKeyDown(keyCode, event);
}

If you also want to intercept the return button, do:

if ((keyCode == KeyEvent.KEYCODE_BACK )) {
    // Upon return / back key:
    // Do NOT go to super.onKeyDown(keyCode, event);
    return true;
}

The HOME button can not be intercepted in this manner.

Hope this helps.