禁用Android的主页按钮4.0+按钮、主页、Android

2023-09-12 02:27:35 作者:轻墨染红颜

我试图取代股票锁屏与我自己的应用程序。 在我的code,我要禁用的Home键。 我知道如何做到这一点的是Android 2.3及以下, 但同样的code不与Android合作4.0+(返回到桌面时,Home键pressed) 最近我发现了名为MiHome一个应用程序,它有自己的锁屏,并能够禁用的主页按钮。 有谁知道它是如何达到这个???

I'm trying to replace the stock lock screen with my own app. In my code, i want to disable the Home button. I know how to do this in Android 2.3 and below, but the same code doesn't work with Android 4.0+ (return to desktop when Home button pressed) Recently I found out an app called MiHome which has its own lock screen and is able to disable the Home button. Does anyone know how it achieves this???

推荐答案

有没有办法拦截在Android的主页按钮,除非你让你的应用程序中的主屏幕上。这是出于安全原因,使恶意应用不能被重写所有可以退出按钮接管您的设备。 home键是一个肯定拍的方式,能够留下任何应用程序。

There is no way to intercept the home button on Android, unless you make your app the home screen. This is for security reasons, so that malicious apps cannot take over your device by overriding all the buttons that can exit. The home button is the one sure shot way to be able to leave any app.

如果你要处理的HOME按键,实现主屏幕。

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