If I want to write a Screensaver or Lockscreen. Is there a way to prevent the home key from going back to the launcher?
Asked
Active
Viewed 1,702 times
2 Answers
1
Simple: when you enter the activity, call
getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
and when you exit the activity, call
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION);

Emmanuel
- 16,791
- 6
- 48
- 74
0
Taking over the home key is an Android no-no.
The only screensaver in Android should be the screen going off. Why would anyone want to run down their battery instead of just pressing one button to turn the screen off and doing the same to turn it back on? It just doesn't make sense on a device with a very limited power supply to run a screensaver.
I'm not quite sure but from what I have read online, custom lock screens can only be done in custom firmware or rooted applications.

Austyn Mahoney
- 11,398
- 8
- 64
- 85
-
Custom lock screens are possible. They may not work perfectly every time but have a look at lockbot. I think they don't capture the home key but change the application that receives the launcher intent every time the home button is pressed. – Janusz Sep 03 '10 at 08:33
-
There are plenty of applications that take over the home launcher intent, including Launcher Pro and the plethora of other launcher replacement apps. If you do take over the intent, then whenever Home is pressed in another screen your application will take over if it is set to the default. You may be able to register the receiver only while in your application to get around this. – Austyn Mahoney Sep 07 '10 at 03:01