the Galaxy S4/S5/S6 Active and the Galaxy XCover models have this extra hardware button. In the settings the user can choose which app the button should open when it is pressed.
I'm developing an app that is specifically targeted at the Galaxy XCover 3. When the user opens the app for the first time, I want to ask the user if they want to let the hardware button open my app.
I have tried to register a broadcastreceiver on the "Camera button" event, but this doesn't work.
Does anyone know how I could achieve this result?
By pushing the XCover key, a construction worker can initiate push-to-talk communications with a colleague, then long-press to launch the flashlight to peer into a dark crawl space.
You can remap the Side key to open any app of your choice. Navigate to and open Settings, tap Advanced features, and then tap Side key. From here, you can select your desired settings.
Press and hold the Volume down and Side buttons, then select Restart > Restart. Note: If you are unable to access the screen to 'Restart' the device or if it becomes unresponsive, press and hold the Volume down and Side buttons simultaneously for 10 seconds, until the device restarts.
I had the same problem and found a solution.
Use the code below to find the keycode.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
super.onKeyDown(keyCode, event);
System.out.println("keycode -->" +keyCode);
System.out.println("Key event -->" + event );
return false;
}
Then make a final int with the keycode.
final int ACTIVE_BUTTON = 1015;
And last write your onKeyDown event.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
switch(keyCode){
case ACTIVE_BUTTON:
//your action here
return true;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With