How to disable Home button without using the TYPE_KEYGUARD?

后端 未结 7 1503
滥情空心
滥情空心 2020-12-24 03:58

i create a lockscreen application and i need to disable a home button, so if that phone is stolen, that phone can\'t be accessed.. my lockscreen is a fullscreen activity.. i

7条回答
  •  醉梦人生
    2020-12-24 04:42

    For a lockscreen Why don't you just use the following:

    @Override
    public void onAttachedToWindow() {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
    }
    

    If the user doesn't have a secure lock screen set, the app will just go to the home screen when your app closes. If the user does have a secure lockscreen set then the standard secure lockscreen will come up next no matter how your app closes. I guess I wouldn't worry about disabling the buttons. The user should be allowed to use the standard security features anyways, because they provide more security then you can guarantee from your app. Plus you don't have to spend the time coding secure unlock features.

提交回复
热议问题