-
안드로이드 시스템 버튼(home, back, active apps) 오버라이드dev/android 2018. 12. 18. 16:30
출처
https://hackernoon.com/disable-android-home-back-and-active-apps-buttons-f7450dfeddcd
# active apps / reorder apps
androidmanifest.xml
<uses-permission android:name="android.permission.REORDER_TASKS" />
activity
@Override
protected void onPause() {
super.onPause();
ActivityManager activityManager = (ActivityManager) getApplicationContext()
.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.moveTaskToFront(getTaskId(), 0);
}
# home
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
# back
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// Do nothing or catch the keys you want to block
}
or
@Override
public boolean onBackPressed(int keyCode, KeyEvent event) {
// Do nothing or catch the keys you want to block
}