質問

I am starting an activity with Theme.Dialog on IncomingCall detected; however, when I start my dialog activity, it hides the Incoming Call Screen which is not the behavior I want. I want to start that dialog activity alone so that it appears on top of the incoming call screen and NOT the WHOLE application on top of the incoming call screen. I used the SingleTask in the Manifest and the NEW_TASK flag and used all sorts of Contexts. as a hint, I want to do something like TrueCaller Android App.

役に立ちましたか?

解決

You need to make sure that the activity with Dialog theme has a different task affinity than the rest of your app. Otherwise, if your app is running, launching that activity (even with FLAG_ACTIVITY_NEW_TASK) will just bring the existing task forward and put your activity on top of that.

You should add the following to the manifest for this specific activity:

android:taskAffinity=""
android:noHistory="true"
android:excludeFromRecents="true"

NOTE: Setting noHistory and excludeFromRecentsensures that this task does NOT show up in the "recent tasks list".

他のヒント

use android:launchMode="singleInstance"

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top