Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able disable Home button on specific android devices

I know this question has been asked many times and the answer is always "No we cant disable home button".

I have a little different query to ask.

I wrote simple code in which my activity overrides the onKeyDown() and return true for all key presses.

In theory this means whoever opens the application is stuck there and has no option to move out of the application.

When i tested this application on different devices, i made following observations :

  1. On motorola device with OS as 2.2.2 , Home button got disabled.
  2. On HTC device with OS as 2.3.5 , Home button got disabled.
  3. On Sony with OS as 2.3.7 , Home button got disabled.
  4. On Samsung with OS as 2.2.1 and 2.3.3 , Home button got disabled.
  5. On Samsung with OS as 2.3.6 and 4.0.4, Home button remained enabled.

These observations are seems very conflicting.

Does any one have any idea , why different devices are behaving differently and what is the best way to handle such scenario.

As per my understanding till now none of the vendors have customized Android OS . Everyone is putting there UI layer on top of it but no one has touched the internals.

like image 980
dexprab Avatar asked Dec 12 '22 03:12

dexprab


1 Answers

I know this question has been asked many times and the answer is always "No we cant disable home button".

If you want to handle the HOME button, implement a home screen.

Does any one have any idea , why different devices are behaving differently

Because they are different devices, and the vendors made changes. Also, in the case of 4.0.4, additional protections may have been added, to help prevent malware authors from hijacking the HOME button without being a home screen.

what is the best way to handle such scenario

If you want to handle the HOME button, implement a home screen.

Everyone is putting there UI layer on top of it but no one has touched the internals.

This is incorrect. Pretty much every device vendor has "touched the internals", to varying degrees. So long as they meet the compatibility requirements for the Play Store, their changes are deemed acceptable by Google.

like image 66
CommonsWare Avatar answered Jan 16 '23 08:01

CommonsWare