机器人:alwaysRetainTaskState =虚假不被尊重,任务状态始终保留 [英] android:alwaysRetainTaskState = false not being respected, task state always retained

查看:475
本文介绍了机器人:alwaysRetainTaskState =虚假不被尊重,任务状态始终保留的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的应用程序表现出安卓说明的默认行为:在的http://developer.android.com/guide/专题/清单/活动的element.html#总是相对=nofollow> Android文档

I would like my app to exhibit the default behaviour described for android:alwaysRetainTaskState in the Android documentation:

通常情况下,系统会清除任务(将删除所有活动
  堆叠根系活力以上)在某些情况下,当用户
  重新选择从主屏幕上的任务。通常,这是如果做
  用户没有访问过的任务要一定的时间,如
  30分钟。

Normally, the system clears a task (removes all activities from the stack above the root activity) in certain situations when the user re-selects that task from the home screen. Typically, this is done if the user hasn't visited the task for a certain amount of time, such as 30 minutes.

这是不是我所看到的。即使>第1天,再开始使用启动器图标我的应用程序使用户返回到他们离开它的地方。
例如,在一个全新的安装我的应用程序启动时显示主屏幕活动小时。然后,用户导航到活动细节:H - > J.在很长一段时间后重新发动,我想用户看到H,而是他们看到Ĵ

This isn't what I'm seeing. Even after >1 day, re-starting my app using the launcher icon returns the user to the place where they left it. For example, after a fresh install my app displays a home screen activity H when launched. The user then navigates to detail activities: H -> J. On relaunching after a long time, I would like the user to see H, but instead they see J.

以上是我在AndroidManifest.xml活动设置的标志:

These are the flags set on my activity in the AndroidManifest.xml:

<activity
    android:name=".AppHomeScreen"
    android:label="@string/app_name"
    android:alwaysRetainTaskState="false"
    android:launchMode="singleTop"
    android:windowSoftInputMode="stateUnchanged">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

我运行Android 4.4.2奇巧

I am running Android KitKat 4.4.2.

有什么原因,我可能不会在这里看到预期的行为?我知道我可以设置的android:clearTaskOnLaunch 的android:finishOnTaskLaunch 每一个用户离开应用程序时明确任务,但这是过于激进,我想描述的行为,其中闲置状态一段长时间后才能忘记了。

Is there any reason why I might not be seeing the expected behaviour here? I know that I could set android:clearTaskOnLaunch or android:finishOnTaskLaunch to clear the task every time the user leaves the app, but this is too aggressive, I'd like the described behaviour where the state is only forgotten after a long period of inactivity.

(Android的文件似乎并没有保证的行为,只有任务中的某些情况下清除,一定的时间后,如30分钟」,也许默认行为已更改和Android文档已经过时了?)

(The Android documentation doesn't seem to guarantee the behaviour, only that the task is cleared in "certain situations" and "after a certain amount of time, such 30 minutes". Maybe the default behaviour was changed and the Android docs are out of date?)

推荐答案

此行​​为是制造商/供应商特定的。在不同的设备上,你会看到不同的行为。有设备的积极清除任务和其他保留任务状态的时间更长的时间。

This behaviour is manufacturer/vendor-specific. On different devices you will see different behaviour. There are devices that aggressively clear out tasks and others that retain task state for much longer periods of time.

这篇关于机器人:alwaysRetainTaskState =虚假不被尊重,任务状态始终保留的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆