Chirag Savsani
Chirag Savsani

Reputation: 6140

How to disable to launch google on long press of home button programmatically?

I want to prevent to launch google if user long press home button.

enter image description here

How to disable this google launcher?

Upvotes: 1

Views: 1145

Answers (1)

Srikanth
Srikanth

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

Related Questions