Hi,

I finally solved it myself. The key to doing the stuf I wanted to do
is
a) the launch mode of an application
b) the whether task reparenting is allowed

I had to

a) set the launch mode of my activtity to 'singleTask', since I want
the activity to be the root of only one task and still allow it to
start other activities in the same task.
b) set allowTaskReparenting to true, so that when I start the activity
from the launcher menu, the existing activity is assigned to the 'new'
task.

It is a bit weird though, that I had to set the reparenting to true,
since the description in the DevGuide somehow reads as if the
singleTask thing should be enough.

Cheers

nleiptv

On 7 Jul., 10:44, nleiptv <nlei...@googlemail.com> wrote:
> Hi everyone,
>
> I have been searching till my fingers bled, so now I decided to ask
> here for help.
> I have the following problem:
> I have written an activity which I start up as soon as the phone has
> finished booting.
> For that I used a Broadcast receiver that listens to BOOT_COMPLETED
> intents.
> All that works fine and the activity is started as planned.
> The activity also shows up in the launcher list, i.e. can be started
> manually.
>
> When the broadcast receiver starts the activity it does so using the
> flag Intent.FLAG_ACTIVITY_NEW_TASK, to make sure that the activity
> (which is not started in any context on autostart) has a task to run
> in.
>
> Problem is that if a user interacts with the autostarted activity and
> then presses the home-button, goes to the launcher menu and selects
> the activity manually, a new instance is started in another task ( i
> guess the launcher's task).
> What do I have to do to allow the user to return to the activity (and
> task) that was started after boot up?
>
> Is there a way to - say - get the task ID from somehwere, then store
> that statically and in onCreate() first check if there is a running
> task already and if so bring that to the front instead of starting a
> new instance?
>
> Any help is greatly appreciated.
>
> Thanks
> nleiptv
--~--~---------~--~----~------------~-------~--~----~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to