Issue
How to disable the mentioned buttons or set it to do nothing ? i know it is possible because ( button mapper )did it using Accessibility service ! even if using root access . how can i do that using android studio ? can you share/write the codes for that ?
Solution
solved
public class example extends AccessibilityService {
@Override
protected boolean onKeyEvent(KeyEvent event) {
int action = event.getAction();
int keyCode = event.getKeyCode();
if (action == KeyEvent.ACTION_UP) {
if (keyCode == 4 && getSharedPreferences("example",0).getBoolean("Back",false)) {
return true;
}
else if (keyCode == 3 && getSharedPreferences("example",0).getBoolean("Home",false)) {
return true;
}
else if (keyCode==KeyEvent.KEYCODE_APP_SWITCH && getSharedPreferences("example",0).getBoolean("Recent",false)){
return true;
}
else {
return false;
}
}
else {
return super.onKeyEvent(event);
}
}
}
Answered By - and-roid
Answer Checked By - David Goodson (JavaFixing Volunteer)