Android - Is It possible to disable the long click of home button to avoid the task manager?
Asked Answered
H

1

11

I am looking for a way to disable the task manager window once I long press on the home button. I managed to disable other device keys (such as volume, menu etc) and the normal click on the home button as I am the default launcher, but I don't know how to disable the task manager! Even Toddler Lock kids app show u the task manager screen following long click, so I assume it isn't easy to do so. I saw few answers say I shouldn't disable the task manager, but I want to have it from another key instead the long click on home button. If needed and will solve my problem, I can be rooted. Please help.

I found a way to do so with Android 2.3.5: Override home and back button is case a boolean is true (I used the piece of code from hotveryspicy) But, as written in this link, this solution isn't working with Android 4.0.3 Can u help me to find a solution for 4.0.3 as well?

Hyperesthesia answered 9/8, 2012 at 11:39 Comment(5)
Why you want to play with android's default behaviour, there is no such api's to track home button.Qualified
I want to make sure the user doesn't get into the settings (or another recent activity displayed inside the task manager screen) and play around.Hyperesthesia
then who is going to use your apps if you are giving this much restriction ;)Qualified
We have the same requirement - we ship Android devices with our app preinstalled to control an industrial manufacturing process. It's the only app the user should be using. Our app is launched at power on so the user should not see any other app. But long press on Home brings up task manager which allows the user to get into all kinds of trouble.Cajole
@DavidArfin This is for a kiosk app where the user experience has to be controlled. It's not even the user's phone!Attitudinize
T
16

To avoid the recent app dialog on the long click home button, you can listen on focus of your activity. When your activity is loosing focus, fire an Intent.ACTION_CLOSE_SYSTEM_DIALOGS intent.

Sample code here: http://www.juliencavandoli.com/how-to-disable-recent-apps-dialog-on-long-press-home-button/

I hope this will help you :)

Thickskinned answered 29/9, 2012 at 11:54 Comment(5)
Maybe you can help me with related question: #12554640Hyperesthesia
Sorry I don't have a solution for that question. Good luck!Thickskinned
@Hyperesthesia i have same requirement and jcavandoli's solution works. but i have created my app as launcher app but on long pressing of home button it allow me to open google. I do not have to allow user to access system without our application. so please help me for the same.Orthodontia
and while connecting a usb plug it open up popup in right side of task bar on clicking of it user is able to access setting window. I have to restrict user for this also.Orthodontia
How about disabling app com.android.systemui? Does this have any "side-effects"?Armistice

© 2022 - 2024 — McMap. All rights reserved.