Disable the main button in Android ICS (4.0)

I am making a proprietary application for a company that will never release it on the Android Market (or the Play Store, in my opinion, now) in Ice Cream Sandwich (Android 4.0).

I need to disable Home so that users cannot maliciously remove the software or delete the data that the application captures. This latest version is the first to be written in 4.0, previous versions were written in 2.2 and 3.2.

To disable the Home button in 2.2, I connected the application as a home replacement, so the button just opened the application, but I can’t use this method anymore, since it somewhat prevents us from updating the application (we don’t want to allow the user to re-select the value by default, as this will delete the data.

Code to disable the "Home" button in 3.2:

@Override public void onAttachedToWindow() { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); super.onAttachedToWindow(); } 

and, in onCreate:

 KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE); KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE); lock.disableKeyguard(); 

But when I run the same code that worked on my tablet 3.2, it does not work on my tablet 4.0.

I was wondering if there is a new API or method that has 4.0 that will implement the same effect as in my version 3.2.

Thanks for any help or guidance.

Adam

+8
android android-3.0-honeycomb keyguard
Apr 09 '12 at 18:12
source share
2 answers

How about a workaround ..

Write a second application that implements the home screen, when the home screen button is pressed, this application will come to the fore. From this application you need to push the main application back to the fore. The only catch is that your application on the main screen should never need to be updated, but you should be able to update the main application freely without a tab asking you to install a home launcher.

Hope this makes sense.

+6
Apr 12 2018-12-12T00:
source share

No ... You cannot redefine the home button for Android4.0 at least .. using the "hotveryspicy" solution. And if you want to answer the HOME button, enter the home screen.

0
Apr 09 '12 at 18:34
source share



All Articles