I have a simple Android application that operates on some text data. The app is invoked two ways: 1) launching the app from the launcher and entering the text data manually, or 2) using the SEND intent to share some text with it.
When launched through the launcher, everything behaves as I expect. When launched through the Share feature and subsequently using the app switcher/recent apps button, the application appears as “Android System” and disappears if I switch away from it. I’d like it to appear in that list like any other app and persist when switched away from. So the question is: why does my app behave differently when launched from the different intents? I’m sure there’s some fundamental thing I’m not understanding about Intents, Activities and Tasks, but I can’t determine where even to look.
Here’s the relevant section of the manifest.
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.stub2.Main"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
</application>
For example the user calls your activity
MainwithACTION_SENDalong with some textabc. Another time, he callsMainwith textzzz. Then you will have 2 instances ofMainin recent list, with different intents.Edit
You can register
ACTION_SENDwith an “adapter” activity likeAdapterActivity, then forward the text toMain. By this way, your app (Mainactivity) will be only listed in recent apps if the user starts it from the launcher.There are more activity tags here.