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

时间:2016-03-15 10:15:37

标签: android

我正在尝试阻止/禁用Android中的最新应用按钮。为此,我尝试使用这个答案:Block/disable recent apps button

然而,它似乎无法奏效。我正在测试用于API 15的模拟设备。这个答案是否适用于API15 +?

我可能会遗漏一些东西吗?

我的应用程序有两个活动,我想要为第二个活动禁用它,所以我已将重写的onPause代码包含在第二个活动中。

提前致谢

编辑:这个问题不是哲学问题,而是它的工作原理。我不是Android的新手,我知道我想要做的是反对在Android中做事情的常用方法。我对此非常有说服力。这个问题即将有其他人工作的东西,并知道它为什么不起作用。

EDIT2:如果在这里标记这个问题是负面的,那么标准似乎没有太多一致,而引用的主题被标记为几乎相同的主题。

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>

1 个答案:

答案 0 :(得分:2)

我已将SDK从API15更新为API19,这样可行。对于那些认为我的问题不合适但是这是我期待的答案(而不是讨论天使的性别)的人,对不起。谢天谢地,希望这个答案对某人有所帮助。