Tuesday, July 5, 2011

[android-developers] Re: Multiple tasks within application

As I understand the reason the activity is started in the current task
is the current task affinity. This affinity is preferable to run the
requested activity. And I don't see the way to change it (number of
affinities in my case is not static).
So it's impossible to implement the described use case without calls
to hidden API (I need that moveTaskToFront method that is available in
the 11th level but is hidden for the 7th one).

On Jul 5, 7:02 pm, Roman Mazur <mazur.ro...@gmail.com> wrote:
> The problem I'm trying to solve is how to support a number of separate
> back stacks and switch between them.
> It's caused by the need to support multiple users of application (and
> device) and to store the state for everyone.
>
> There was the next implementation attempt.
> When a new task is required for a user, an appropriate activity is
> started with flags
> Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK |
> Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS.
> Such an activity intent has an action value unique for a particular
> user (contains user's ID).
> Then we can determine whether a task for some user exists checking
> recent applications info from ActivityManager. In such case an
> activity is started by an intent without FLAG_ACTIVITY_MULTIPLE_TASK.
>
> This intent is hoped to bring an appropriate task to front. But
> instead we have a new activity instance (described by the intent) in
> the current task. There is no switching between tasks :(
> What is the reason of such behavior? Task affinities?
>
> PS. I saw moveTaskToFront method in ActivityManager but it's available
> for API 11 level only. I have to support the 7th level.
>
> Thanks in advance.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment