I am dealing with a strange issue here.
Basically, I have one application (made by another developer) that has an activity that specifies its taskAffinity to "" and its launchMode to "singleTask".
When the phone receives a notification, I launch an activity in my application with FLAG_ACTIVITY_NEW_TASK flag.
I would like my activity to have a taskAffinity for that other application if the task exists.
When I do dumpsys activity I see that the other developers application TaskRecord is:
aj.streetPhone.app/.ViewActivity
However, in my manifest on my activity I specify aj.streetphone.app it does not seem to add my activity to that applications task. I have tried another package name and it seems to be working. The problem perhaps has to do with the fact that the task name includes the activity, not just the package name (the default).
I am basically having a problem to use the '/' because the manifest does not accept it.
android:taskAffinity="aj.streetPhone.app/.ViewActivity" <--- does not work!
I have tried escaping the '/', added by unicode, everything. Please help!
Any ideas?
Task affinities (and permissions, and processes, and shared user IDs, and actions, etc etc) are NOT qualified by the app package name. They are a single string, much must be globally unique. Just adding a ".foo" does not make it unique because another app could have a package name that is a shorter or longer version of your own and also come up with the same name. So for affinities and processes, you can use a ":" prefix in the name to append it to your own package name and create a name that is guaranteed unique for your package.
So you have to use a unique string for your task affinity.