试图禁用android中的最近的应用程序按钮

问题描述:

我试图阻止/禁用Android中的最近的应用程序按钮。为此,我试图使用这个答案:Block/disable recent apps button试图禁用android中的最近的应用程序按钮

但是,它似乎不工作。我正在测试API 15的模拟设备。API15 +的答案是否正确?

我可能会错过什么吗?

我的应用程序有两个活动,我希望它被禁用的第二个,所以我已包含重写的onPause代码到第二个活动。

在此先感谢

编辑:这是问题不是哲学,它是关于有它的工作。我在Android中并不陌生,我知道我想要做的是违背Android中常见的做法。我完全了解它。这个问题即将有一些其他人已经开始工作,并知道为什么它不工作。

编辑2:它似乎没有太多一致的标准,如果你在这里标记这个问题消极,而被引用的线程肯定标记为几乎相同的话题。

EDIT3:清单

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
      package="com.sample" 
      android:versionCode="1" 
      android:versionName="1.0"> 
    <uses-sdk android:minSdkVersion="15"/> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
    <uses-permission android:name="android.permission.REORDER_TASKS" /> 
    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> 
     <activity android:name=".InitPage" 
     android:label="@string/app_name" 
     android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN"/> 
       <category android:name="android.intent.category.LAUNCHER"/> 
      </intent-filter> 
     </activity> 
     <activity android:name=".MainPage" 
     android:label="@string/app_name" 
     android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN"/> 
       <category android:name="android.intent.category.LAUNCHER"/> 
       <category android:name="android.intent.category.HOME" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
      </intent-filter> 
     </activity> 
    </application> 
</manifest> 
+0

幸运的是,你不能禁用任何硬件按钮 – pskink

+0

我需要这样做,因为它将是一个应用程序,将部署在公共基础设施和人们将使用它。然后,我不希望人们摆脱应用程序。我想允许一种独特的方式摆脱设备的管理员将知道的应用程序 – jevora

+0

想象一个应用程序,禁用后面和主页按钮,你想使用它吗?我不会,如果你想要这样的应用程序写你自己的家庭发射器 – pskink

我已经更新从API15 SDK来API19和工作原理。对不起所有那些认为我的问题不合适的人,但这是我期待的答案(而不是讨论天使的性别)。谢谢你,希望这个答案有助于某人。