Reputation: 6140
I want to prevent to launch google if user long press home button.
How to disable this google launcher?
Upvotes: 1
Views: 1145
Reputation: 1575
ActivityManager activityManager = (ActivityManager) getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
activityManager.moveTaskToFront(getTaskId(), ActivityManager.MOVE_TASK_NO_USER_ACTION);
This will not disable Home button long press but, will keep your task front always so, even you open any other app from your application it will be in background. this need permission android.permission.REORDER_TASKS
Upvotes: 2