[android-developers] Re: Activity onResumed not getting called
Yeah I think by default if the app is not resumed for some period of time, android will restart the app instead of resuming it: http://developer.android.com/guide/topics/manifest/activity-element.html look at: "android:alwaysRetainTaskState" On Sep 23, 11:01 am, Albert wrote: > Hi, > > I'm having a very odd issue. I launch my app, use it then press the > "Home" key and the app pauses and goes to the background. I can also > resume it by launch it again, so far so good but if I leave it sitting > on the background for a couple of hours and try to launch it, it calls > onCreate() (on the paused activity) instead of just resuming, > therefore loosing the previous state, it behaves as that screen is the > entry point of the app. > > Has anyone seen a similar issue. Does someone know if this is a normal > behaviour?? What I am missing here? > > Thanks, > Alberto -- 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
[android-developers] Re: Activity onResumed not getting called
Yes I'm good with all that. My question is: Why doesn't the app starts from the initial entry point screen? Why does it try to start from the last opened Activity since the process has effectively being killed. Ex. app launched and ActivityA(entry point of the app) starts, from there I go to Activity2, then Activity3 and press Home. In the mid time the process gets killed by the OS, I then launch the app and instead to start from Activity1 it does from Actitvity3 Thanks! On Sep 23, 4:10 pm, Mark Wyszomierski wrote: > Yeah I think by default if the app is not resumed for some period of > time, android will restart the app instead of resuming it: > > http://developer.android.com/guide/topics/manifest/activity-element.html > > look at: "android:alwaysRetainTaskState" > > On Sep 23, 11:01 am, Albert wrote: > > > > > Hi, > > > I'm having a very odd issue. I launch my app, use it then press the > > "Home" key and the app pauses and goes to the background. I can also > > resume it by launch it again, so far so good but if I leave it sitting > > on the background for a couple of hours and try to launch it, it calls > > onCreate() (on the paused activity) instead of just resuming, > > therefore loosing the previous state, it behaves as that screen is the > > entry point of the app. > > > Has anyone seen a similar issue. Does someone know if this is a normal > > behaviour?? What I am missing here? > > > Thanks, > > Alberto -- 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
[android-developers] Re: Activity onResumed not getting called
It looks like attribute this could solve the issue: android:alwaysRetainTaskState Whether or not the state of the task that the activity is in will always be maintained by the system — "true" if it will be, and "false" if the system is allowed to reset the task to its initial state in certain situations. The default value is "false". This attribute is meaningful only for the root activity of a task; it's ignored for all other activities. 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. However, when this attribute is "true", users will always return to the task in its last state, regardless of how they get there. This is useful, for example, in an application like the web browser where there is a lot of state (such as multiple open tabs) that users would not like to lose. --- I will try it and post back the results. -- 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
[android-developers] Re: Activity onResumed not getting called
Again, that is normal behavior. When the user comes back to your app, the last activity that was visible to the user will be shown. If your app's process wasn't killed, that last activity is just shown. If your app's process was killed, then that last-activity will be re-created first. The fact that the process was killed or not is transparent to the end-user. This is for default launch-modes of your activities. You can change this behavior (somewhat) by modifying your activities' launch-modes/ properties in the manifest file. On Sep 23, 11:19 am, Albert wrote: > Yes I'm good with all that. My question is: > > Why doesn't the app starts from the initial entry point screen? Why > does it try to start from the last opened Activity since the process > has effectively being killed. > > Ex. app launched and ActivityA(entry point of the app) starts, from > there I go to Activity2, then Activity3 and press Home. In the mid > time the process gets killed by the OS, I then launch the app and > instead to start from Activity1 it does from Actitvity3 > > Thanks! > > On Sep 23, 4:10 pm, Mark Wyszomierski wrote: > > > > > Yeah I think by default if the app is not resumed for some period of > > time, android will restart the app instead of resuming it: > > >http://developer.android.com/guide/topics/manifest/activity-element.html > > > look at: "android:alwaysRetainTaskState" > > > On Sep 23, 11:01 am, Albert wrote: > > > > Hi, > > > > I'm having a very odd issue. I launch my app, use it then press the > > > "Home" key and the app pauses and goes to the background. I can also > > > resume it by launch it again, so far so good but if I leave it sitting > > > on the background for a couple of hours and try to launch it, it calls > > > onCreate() (on the paused activity) instead of just resuming, > > > therefore loosing the previous state, it behaves as that screen is the > > > entry point of the app. > > > > Has anyone seen a similar issue. Does someone know if this is a normal > > > behaviour?? What I am missing here? > > > > Thanks, > > > Alberto- Hide quoted text - > > - Show quoted text - -- 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
[android-developers] Re: Activity onResumed not getting called
Is it possible by using different activity attributes to: -Have the app launch from the last activity IF the process of the app has not being killed The issue is that the info that the app needs is downloaded and parsed at the entry point of the app, then depending of where you go it downloads more data, so if the app tries to launch an activity that does not have the info it needs to display... I would like to keep the activity available but only for as long as the process is active. Thanks a lot, im playing around with the attributes but no luck yet. Alberto On Sep 24, 12:49 am, Dianne Hackborn wrote: > What you are seeing is the normal user interaction. The user is not aware > the process has been killed, so they expect to return to the app in the way > they last saw it. > > alwaysRetainTaskState is a totally separate thing, and allows you to turn > off a facility where if the user hasn't been in your app for a while, upon > returning to it its task can be reset. This is independent of whether or > not its process needs to be restarted. > > > > > > On Thu, Sep 23, 2010 at 8:22 AM, Albert wrote: > > > It looks like attribute this could solve the issue: > > > --- > > - > > android:alwaysRetainTaskState > > > Whether or not the state of the task that the activity is in will > > always be maintained by the system — "true" if it will be, and "false" > > if the system is allowed to reset the task to its initial state in > > certain situations. The default value is "false". This attribute is > > meaningful only for the root activity of a task; it's ignored for all > > other activities. > > 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. > > However, when this attribute is "true", users will always return to > > the task in its last state, regardless of how they get there. This is > > useful, for example, in an application like the web browser where > > there is a lot of state (such as multiple open tabs) that users would > > not like to lose. > > > --- > > > > > I will try it and post back the results. > > > -- > > 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 > cr...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. -- 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
[android-developers] Re: Activity onResumed not getting called
> -Have the app launch from the last activity IF the process of the app > has not being killed OK, it now works and behaves as I wanted. I could not do it through activities attributes so I set a static variable that would signal whether the process is alive or dead, if dead I just launch my main screen and I clear the stack using the flags... If anyone has a better solution I'm all ears. Cheers, Alberto On Sep 24, 10:33 am, Albert wrote: > Is it possible by using different activity attributes to: > > -Have the app launch from the last activity IF the process of the app > has not being killed > > The issue is that the info that the app needs is downloaded and parsed > at the entry point of the app, then depending of where you go it > downloads more data, so if the app tries to launch an activity that > does not have the info it needs to display... I would like to keep the > activity available but only for as long as the process is active. > > Thanks a lot, im playing around with the attributes but no luck yet. > > Alberto > > On Sep 24, 12:49 am, Dianne Hackborn wrote: > > > > > What you are seeing is the normal user interaction. The user is not aware > > the process has been killed, so they expect to return to the app in the way > > they last saw it. > > > alwaysRetainTaskState is a totally separate thing, and allows you to turn > > off a facility where if the user hasn't been in your app for a while, upon > > returning to it its task can be reset. This is independent of whether or > > not its process needs to be restarted. > > > On Thu, Sep 23, 2010 at 8:22 AM, Albert wrote: > > > > It looks like attribute this could solve the issue: > > > > --- > > > - > > > android:alwaysRetainTaskState > > > > Whether or not the state of the task that the activity is in will > > > always be maintained by the system — "true" if it will be, and "false" > > > if the system is allowed to reset the task to its initial state in > > > certain situations. The default value is "false". This attribute is > > > meaningful only for the root activity of a task; it's ignored for all > > > other activities. > > > 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. > > > However, when this attribute is "true", users will always return to > > > the task in its last state, regardless of how they get there. This is > > > useful, for example, in an application like the web browser where > > > there is a lot of state (such as multiple open tabs) that users would > > > not like to lose. > > > > --- > > > > > > > I will try it and post back the results. > > > > -- > > > 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 > > cr...@googlegroups.com> > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > > -- > > Dianne Hackborn > > Android framework engineer > > hack...@android.com > > > Note: please don't send private questions to me, as I don't have time to > > provide private support, and so won't reply to such e-mails. All such > > questions should be posted on public forums, where I and others can see and > > answer them. -- 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
[android-developers] Re: Activity onResumed not getting called
Hi, this is normal behaviour. If your application is paused for a long period of time and other applications need more memory, the system can just drop your application from memory. You may have a look at the activity lifecycle page from the android dev-guide to fully understand this process: http://developer.android.com/guide/topics/fundamentals.html#actlife On 23 Sep., 17:01, Albert wrote: > Hi, > > I'm having a very odd issue. I launch my app, use it then press the > "Home" key and the app pauses and goes to the background. I can also > resume it by launch it again, so far so good but if I leave it sitting > on the background for a couple of hours and try to launch it, it calls > onCreate() (on the paused activity) instead of just resuming, > therefore loosing the previous state, it behaves as that screen is the > entry point of the app. > > Has anyone seen a similar issue. Does someone know if this is a normal > behaviour?? What I am missing here? > > Thanks, > Alberto -- 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
Re: [android-developers] Re: Activity onResumed not getting called
What you are seeing is the normal user interaction. The user is not aware the process has been killed, so they expect to return to the app in the way they last saw it. alwaysRetainTaskState is a totally separate thing, and allows you to turn off a facility where if the user hasn't been in your app for a while, upon returning to it its task can be reset. This is independent of whether or not its process needs to be restarted. On Thu, Sep 23, 2010 at 8:22 AM, Albert wrote: > > It looks like attribute this could solve the issue: > > > > android:alwaysRetainTaskState > > Whether or not the state of the task that the activity is in will > always be maintained by the system — "true" if it will be, and "false" > if the system is allowed to reset the task to its initial state in > certain situations. The default value is "false". This attribute is > meaningful only for the root activity of a task; it's ignored for all > other activities. > 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. > However, when this attribute is "true", users will always return to > the task in its last state, regardless of how they get there. This is > useful, for example, in an application like the web browser where > there is a lot of state (such as multiple open tabs) that users would > not like to lose. > > --- > > I will try it and post back the results. > > -- > 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 > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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