I have a Notification which starts an Activity. After a long press on home button and selecting my app, I want to start my main Activity again, and not this Activity started
It's not clear to me what you want.
"How can I have my app in the recents, but have the main Activity started?"
If you want to always start one activity using the long home-press, you can define your activity as singleTask
in the manifest.
That way, when you select the shortcut in the long press HOME, it will always show the MAIN, singleTask
activity. I say this because I used this behavior before once. ;-)
I believe that by using this you can still start an activity from the notification normally, using, say, Intent
s.
In the activity tag:
android:launchMode="singleTask"
>