简体   繁体   English

如何禁用Android中的最近活动按钮?

[英]How to disable recent activity button in Android?

I know that this question was asked before here Block/disable recent apps button , but the answer is not working. 我知道这个问题在此之前被问到阻止/禁用最近的应用程序按钮 ,但答案不起作用。

@Override
protected void onPause() {
    super.onPause();

    ActivityManager activityManager = (ActivityManager) getApplicationContext()
            .getSystemService(Context.ACTIVITY_SERVICE);

    activityManager.moveTaskToFront(getTaskId(), 0);
}

I used this code on 5.1 SDK. 我在5.1 SDK上使用了这段代码。 It's working, but the same program on 6.0 device is not working. 它工作正常,但6.0设备上的相同程序无法正常工作。

I want to make screen lock but have not found any solution on block recent app button 我想制作屏幕锁定,但在块最近的应用程序按钮上找不到任何解决方案

最好的解决方案是,你可以减少显示最近的应用程序的时间几乎为零许多应用程序这样做....而不是试图阻止最近的应用程序按钮尝试显示最近的应用程序到最短的时间...它的工作周围,​​它应该适合您的需要

i found another way to wipe recent apps.Yes you can disable all hardware keys you should google how to disable hardware keys it can be done on rooted devices and through it you can.The key to disable recent app will be (KeyEvent.KEYCODE_APP_SWITCH); 我找到了另一种方法来擦除最近的应用程序。你可以禁用所有硬件密钥,你应该谷歌如何禁用硬件密钥,它可以在root设备上完成,你可以通过它。禁用最近的应用程序的密钥将是(KeyEvent.KEYCODE_APP_SWITCH) ; KEYCODE_APP_SWITCH= Key code constant: App switch key. KEYCODE_APP_SWITCH =密钥代码常量:应用程序切换密钥。 Should bring up the application switcher dialog. 应调出应用程序切换器对话框。

ill share a small sample code to help you. 生病共享一个小样本代码来帮助你。

List<Integer> currentHdKeys = new ArrayList<Integer>();
if (SharedPref.recentApps())
        {
            currentHdKeys.add(KeyEvent.KEYCODE_APP_SWITCH);
        }

now just use recentapps method to set wiping of recent apps to true or false. 现在只需使用recentapps方法将最近的应用程序擦除为true或false。 please give me an up vote if you like it 如果你喜欢,请给我一个投票

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM