Step 1- Application is not exist in recent app list (App has been removed from recent app list).
Step 2- As soon as I got notification open IncomingCall activity, User a
Add
android:excludeFromRecents="true"
to the activity tag of your launcher activity in AndroidManifest.xml file
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:excludeFromRecents="true">
....
</activity>
Thanks God, I got answer after wondering a week. Add singleInstance attribute along with exclude from recent. It was a bug in 5.0 now has been resolved in 5.1
<activity
android:name="activityName"
android:excludeFromRecents="true"
android:launchMode="singleInstance"
>
</activity>
As per you needs, finishAndRemoveTask() is the new API that as per the documentation
Finishes all activities in this task and removes it from the recent tasks list.
if(android.os.Build.VERSION.SDK_INT >= 21)
{
finishAndRemoveTask();
}
else
{
finish();
}