Application is not displayed in recent apps lists

2019-02-12 12:27发布

问题:

My application is never shown in the RECENT APPS list whenever I put the following piece of code in my activity's manifest entry

<category android:name="android.intent.category.DEFAULT" />

If I remove above line it works fine. I've also made sure that the following flags are set to false-

        android:noHistory="false"
        android:excludeFromRecents="false"

But still its never displayed even if I launch app manually.

In case anybody wants to have a look the manifest, its-

<?xml version="1.0" encoding="UTF-8"?>

<uses-sdk android:minSdkVersion="8" />

<application
    android:name="com.raj.poc.copypaste.MainApplication"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".CopyPasteActivity"
        android:launchMode="singleTop"
        android:noHistory="false"
        android:excludeFromRecents="false"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <action android:name="android.intent.action.SEARCH_LONG_PRESS" />
            <category android:name="android.intent.category.DEFAULT" /> 
        </intent-filter>
    </activity>
</application>

回答1:

It may also happen if you set

    <activity... android:label=""/>

for your main Activity



回答2:

This is the only activity in your application, right?

You are using the category tag twice. You have written in your code

   <category android:name="android.intent.category.LAUNCHER" /> 

so you have already selected the category. When you add a new activity then you will write the Default category tag.