Questions tagged [taskaffinity]
29 questions
119
votes
3 answers
Android Task Affinity Explanation
What exactly is the attribute taskAffinity used for? I have gone through the documentation but I couldn't understand much.
Can anyone explain task affinity in laymans terms?

Traxex1909
- 2,650
- 4
- 20
- 25
14
votes
1 answer
setting cpu affinity of a process from the start on linux
I want to set the cpu affinity of a process on linux when it is starting.
There are methods like sched_setaffinity and taskset, but they need the processid of the process. They may cause potential migration like a process was started on a core but…

ajay saini
- 305
- 1
- 2
- 8
10
votes
1 answer
android 4.4.X: taskAffinity & launchmode vs. Activity lifecycle
I developed a simple application, which demostrates some strange behaviour on Android 4.4.X devices I noticed.
Lets say I want to have 2 "main" activities, where the first says "Hello" (by starting 'HelloActivity') every second time it is resumed…

Berťák
- 7,143
- 2
- 29
- 38
10
votes
2 answers
How to remove singleTask activity with taskAffinity from recent tasks when it is finished?
Let assume we have two activities.
A - main activity, that is "home launcher enabled" (proper intent filters etc.)
B - task root activity with singleTask specification (there can be only one instance of this activity) and with custom taskAffinity…

Michael P
- 670
- 7
- 23
7
votes
1 answer
How does android:taskaffinity work?
How does android:taskaffinity attribute work?
As per my understanding, pressing the Home key will move the activity to back stack, but it will not be destroyed. I am confused.

user1933455
- 71
- 1
- 3
3
votes
1 answer
Not Working corss-application activities with taskAffinity in Android 11
I have two application, App A and App B, now I want to start an activity in App B from App A, the launchmode of this Activity is “singleTask”.
The order:
Activity X (App A) ———> Activity Y (App B) ———> Activity Z (App B, launchMode=“singleTask”)
As…

YikFung
- 31
- 1
3
votes
2 answers
task affinity for singleInstance activity?
I want to know what is the default task affinity for singleInstance activity?
Since each singleInstance Activity opens up as root activity in a new task.
and there is no need to declare android:taskAffinity.
See I have read the developer guides and…

Yogesh Seralia
- 340
- 5
- 23
2
votes
1 answer
Check value of PF_NO_SETAFFINITY
Is it possible to tell whether a process/thread has the PF_NO_SETAFFINITY flag set? I'm running taskset on a series of process ids and some are throwing errors of the following form:
taskset: failed to set pid 30's affinity: Invalid argument
I…

Will
- 1,171
- 2
- 14
- 26
2
votes
3 answers
Android launch an activity from a broadcast receiver
I know it may not be best practice but this is what i want to do.
When my broadcast receiver is called - start a new activity which has is not fullscreen and has a transparent background - which opens on top of your current activity / desktop…

RenegadeAndy
- 5,440
- 18
- 70
- 130
2
votes
1 answer
How to change task affinity in Android?
There is an activity (A) in my application that can be called from other apps (B)
if A is called from B, in recent task there are an instance of B and an instance of A. i want that A be showen as part of B Task.
I've found that by adding same…
user3473590
2
votes
2 answers
Commutative property of the commands
I need to ask this question just to double check the answer.
Does the order of the commands matter? For example:
Is this command
taskset 0x2 time echo "foo"
equal than
time taskset 0x2 echo "foo"
?
I need to know if all the commands followed by…

Carlos Vega
- 1,341
- 2
- 13
- 35
2
votes
1 answer
starting an Activity from Broadcast Receiver brings up Default Activity
My app contains two activity, one widget and a broadcast receiver.
First activity is default one which is called by home launcher. Second activity is a reminder dialog activity which plays a MP3 and has a dismiss button. It will appear on home…

Ali
- 21,572
- 15
- 83
- 95
1
vote
1 answer
Issue with taskAffinity and excludeFromRecents on Android 10
I have an application which is sometimes displaying notifications to users.
When pressing a notification, a "Dispatch" Activity is triggered which calls startActivities with some intents leading to proper activity depending on the notification…

Loïc
- 353
- 2
- 10
1
vote
0 answers
How to make FLAG_ACTIVITY_NEW_TASK ignore taskAffinity?
I have a problem with two of the buttons in a launcher app I'm developing. The first button should launch TotalCommander's built-in text editor to display a certain text file. The second button should launch TotalCommander. So I started with the…

Tamás Bolvári
- 2,976
- 6
- 34
- 57
1
vote
1 answer
When taskAffinity activity is calling finish() but it is not dismiss recent apps
I have taskAffinity activity which is BActivity and AActivity is a normal activity.
AActivity is calling BActivity by using below startActivity function. When BActivity's jobs have done, BActivity called finish(); function but BActivity doesn't…

begiNNer
- 128
- 12