需要新的任务backstack单一的活动 [英] Need single activity in new task backstack
问题描述
这是噩梦的时候必须处理机器人的任务和启动模式(标志)。
It is nightmare when must deal with android task and launching modes(flags).
需要完成这样的情景:
从后台服务的推出活动[1]属于应用[A]在新的任务。 当用户去[返回] - !结束活动[1],并恢复任何应用程序是pviously $ P $前景
From background service launch Activity[1] that belongs to App[A] in new task. When user go [back] - finish activity[1] and resume whatever App was previously in foreground!
如果应用[A]活跃,运行 - 是没有问题的,[贝克]关闭活动[1]和恢复应用[J]。 但是,如果其他任何应用程序[B]是在前台的时刻发射活动[1](即使有新的任务)的所有应用程序时,[A]任务和协议栈出面了应用[B],并打破了[返回]导航。 我想看到应用程序[B],从活动导航回来后[1]。
If App[A] was active and running - there is no problem, [beck] close Activity[1] and resume App[A]. But if any other App[B] is in foreground at the moment when launching Activity[1] (even with the new Task) all App[A] tasks and stacks came forward over App[B] and broke [back] navigation. I suppose to see App[B] after navigating back from Activity[1].
试了组合的标志,但它们都没有完成的任务需要。
Tried several flag combination, but none of them accomplish what needed.
适用,只有当应用程序[A]运行:
Suitable only when App[A] running:
Intent.AddFlags(ActivityFlags.NewTask);
Intent.AddFlags(ActivityFlags.ReorderToFront);
Intent.AddFlags(ActivityFlags.ExcludeFromRecents);
适用,只有当应用程序[B]运行(清除应用[A] backstack):
Suitable only when App[B] running (clears App[A] backstack):
Intent.AddFlags(ActivityFlags.NewTask);
Intent.AddFlags(ActivityFlags.ClearTask);
Intent.AddFlags(ActivityFlags.ExcludeFromRecents);
如何配置意向推出只有一个independed活动[1],并返回到恢复无论是pviously $ P $在屏幕上?
How to configure Intent to launch only one independed Activity[1] and go back to resume whatever was previously on screen?
推荐答案
我觉得 Intent.FLAG_ACTIVITY_MULTIPLE_TASK
标记会做
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY);
这篇关于需要新的任务backstack单一的活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!