You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Michal Mocny <mm...@google.com> on 2014/02/14 20:08:06 UTC

[Android] Apps restart instead of resume when brought to focus by clicking app icon

TLDR; AndroidManifest.xml <activity> needs: android:launchMode="singleTop"
-- can I add it?

Quick search brings up:
http://stackoverflow.com/questions/10122449/phonegap-android-application-restarting-instead-of-resuming-although-it-was-not

..which advises to add android:launchMode="singleTask" to
AndroidManifest.xml <activity>, which does fix the issue.

According to the descriptions in
http://developer.android.com/guide/topics/manifest/activity-element.htmlthe
differences mostly stem in how the app handles intents, however, there
is a comment in the table of descriptions which labels singleTask
launchMode as  "(not recommended for general use)".

On the other hand, singleTop mode *is* recommended, and also fixes the
issue, and according to the description, sounds to me like a much better
default.

So, does anyone have a reason to not set android:launchMode="singleTop" in
the default cordova-android platform template?

I notice Simon commented on the above SO question, so I guess we were
already aware of the issue a while ago.  Is there a conscious reason for
not setting that launchMode by default, or did this just slip through the
cracks?  Is there a known downside?

-Michal

Re: [Android] Apps restart instead of resume when brought to focus by clicking app icon

Posted by Andrew Grieve <ag...@chromium.org>.
Sounds to me like singleTop is a better default for now. Apps can still
change it if they add logic to handle intents.


On Sat, Feb 15, 2014 at 8:42 AM, Michal Mocny <mm...@chromium.org> wrote:

> CB-6048
>
>
> On Sat, Feb 15, 2014 at 8:39 AM, Michal Mocny <mm...@chromium.org> wrote:
>
> >
> >
> >
> > On Fri, Feb 14, 2014 at 5:26 PM, Joe Bowser <bo...@gmail.com> wrote:
> >
> >> On Fri, Feb 14, 2014 at 12:28 PM, Michal Mocny <mm...@chromium.org>
> >> wrote:
> >> > Joe, I think you may have that backwards.  singleTop means we don't
> get
> >> get
> >> > restarted so avoid the issue of preserving state.  If we leave the
> >> > launchMode as the default, we *do* get killed off and lose state.
> >>
> >> Yeah, I did, which is why I changed my mind. :P
> >>
> >> We still should fix preserving state, and I'm not convinced that this
> >> is the right thing to do in all instances.
> >>
> >> >
> >> > Braden, if I understand what you say correct, singleTop is not good
> for
> >> > apps that have multiple activities which it launches conditionally
> >> > depending on incoming intent, but we do not so its a fine default?
> >> >
> >>
> >> We totally could have that, it depends on the plugin, which is why I
> >> propose that this be a config setting.
> >>
> >
> > Okay, fair!  Is singleTop a good default, or should we leave it as
> > standard as it is now?
> >
> >
> >>
> >>
> >>
> >> > Bas, thanks for pointing that out.  Seems they advise same default
> >> > launchMode.
> >> >
> >> > -Michal
> >> >
> >> >
> >> > On Fri, Feb 14, 2014 at 3:01 PM, Bas Bosman <co...@nazgul.nu>
> wrote:
> >> >
> >> >> Just wanted to point out a Pull Request on a Phonegap Build plugin
> >> related
> >> >> to this subject:
> >> >> https://github.com/phonegap-build/PushPlugin/pull/149
> >> >>
> >> >> Don't have any expertise on the issue, but remembered reading this
> PR a
> >> >> few days ago.
> >> >>
> >> >> Bas
> >> >>
> >> >> > OK, I changed my mind after re-reading the docs once again.
> >> >> >
> >> >> > We should make this a configurable option ideally.  singleTop might
> >> >> > make sense for legacy webview apps, but I'd have to see the way
> that
> >> >> > we do WebView.  We still need to solve state preservation though.
> >> >> >
> >> >> > On Fri, Feb 14, 2014 at 11:20 AM, Joe Bowser <bo...@gmail.com>
> >> wrote:
> >> >> >> Agreed.  If we keep re-starting over and over again, we lose
> state.
> >> >> >> We haven't been successful in preserving the state of the app when
> >> we
> >> >> >> get killed off, so I think singleTop is a really terrible idea
> until
> >> >> >> we get state preservation solved, which is a really hard problem.
> >> >> >>
> >> >> >> On Fri, Feb 14, 2014 at 11:14 AM, Braden Shepherdson
> >> >> >> <br...@chromium.org> wrote:
> >> >> >>> I think singleTop is "not recommended" for typical Android apps,
> >> that
> >> >> >>> want
> >> >> >>> to go opening different activities using various Intents from
> >> >> >>> notifications. For something like Cordova, avoiding that restart
> is
> >> >> >>> ideal.
> >> >> >>>
> >> >> >>> Braden
> >> >> >>>
> >> >> >>>
> >> >> >>> On Fri, Feb 14, 2014 at 2:08 PM, Michal Mocny <mmocny@google.com
> >
> >> >> >>> wrote:
> >> >> >>>
> >> >> >>>> TLDR; AndroidManifest.xml <activity> needs:
> >> >> >>>> android:launchMode="singleTop"
> >> >> >>>> -- can I add it?
> >> >> >>>>
> >> >> >>>> Quick search brings up:
> >> >> >>>>
> >> >> >>>>
> >> >>
> >>
> http://stackoverflow.com/questions/10122449/phonegap-android-application-restarting-instead-of-resuming-although-it-was-not
> >> >> >>>>
> >> >> >>>> ..which advises to add android:launchMode="singleTask" to
> >> >> >>>> AndroidManifest.xml <activity>, which does fix the issue.
> >> >> >>>>
> >> >> >>>> According to the descriptions in
> >> >> >>>>
> >> >>
> >>
> http://developer.android.com/guide/topics/manifest/activity-element.htmlthe
> >> >> >>>> differences mostly stem in how the app handles intents, however,
> >> there
> >> >> >>>> is a comment in the table of descriptions which labels
> singleTask
> >> >> >>>> launchMode as  "(not recommended for general use)".
> >> >> >>>>
> >> >> >>>> On the other hand, singleTop mode *is* recommended, and also
> >> fixes the
> >> >> >>>> issue, and according to the description, sounds to me like a
> much
> >> >> >>>> better
> >> >> >>>> default.
> >> >> >>>>
> >> >> >>>> So, does anyone have a reason to not set
> >> >> >>>> android:launchMode="singleTop" in
> >> >> >>>> the default cordova-android platform template?
> >> >> >>>>
> >> >> >>>> I notice Simon commented on the above SO question, so I guess we
> >> were
> >> >> >>>> already aware of the issue a while ago.  Is there a conscious
> >> reason
> >> >> >>>> for
> >> >> >>>> not setting that launchMode by default, or did this just slip
> >> through
> >> >> >>>> the
> >> >> >>>> cracks?  Is there a known downside?
> >> >> >>>>
> >> >> >>>> -Michal
> >> >> >>>>
> >> >> >
> >> >>
> >> >>
> >> >>
> >>
> >
> >
>

Re: [Android] Apps restart instead of resume when brought to focus by clicking app icon

Posted by Michal Mocny <mm...@chromium.org>.
CB-6048


On Sat, Feb 15, 2014 at 8:39 AM, Michal Mocny <mm...@chromium.org> wrote:

>
>
>
> On Fri, Feb 14, 2014 at 5:26 PM, Joe Bowser <bo...@gmail.com> wrote:
>
>> On Fri, Feb 14, 2014 at 12:28 PM, Michal Mocny <mm...@chromium.org>
>> wrote:
>> > Joe, I think you may have that backwards.  singleTop means we don't get
>> get
>> > restarted so avoid the issue of preserving state.  If we leave the
>> > launchMode as the default, we *do* get killed off and lose state.
>>
>> Yeah, I did, which is why I changed my mind. :P
>>
>> We still should fix preserving state, and I'm not convinced that this
>> is the right thing to do in all instances.
>>
>> >
>> > Braden, if I understand what you say correct, singleTop is not good for
>> > apps that have multiple activities which it launches conditionally
>> > depending on incoming intent, but we do not so its a fine default?
>> >
>>
>> We totally could have that, it depends on the plugin, which is why I
>> propose that this be a config setting.
>>
>
> Okay, fair!  Is singleTop a good default, or should we leave it as
> standard as it is now?
>
>
>>
>>
>>
>> > Bas, thanks for pointing that out.  Seems they advise same default
>> > launchMode.
>> >
>> > -Michal
>> >
>> >
>> > On Fri, Feb 14, 2014 at 3:01 PM, Bas Bosman <co...@nazgul.nu> wrote:
>> >
>> >> Just wanted to point out a Pull Request on a Phonegap Build plugin
>> related
>> >> to this subject:
>> >> https://github.com/phonegap-build/PushPlugin/pull/149
>> >>
>> >> Don't have any expertise on the issue, but remembered reading this PR a
>> >> few days ago.
>> >>
>> >> Bas
>> >>
>> >> > OK, I changed my mind after re-reading the docs once again.
>> >> >
>> >> > We should make this a configurable option ideally.  singleTop might
>> >> > make sense for legacy webview apps, but I'd have to see the way that
>> >> > we do WebView.  We still need to solve state preservation though.
>> >> >
>> >> > On Fri, Feb 14, 2014 at 11:20 AM, Joe Bowser <bo...@gmail.com>
>> wrote:
>> >> >> Agreed.  If we keep re-starting over and over again, we lose state.
>> >> >> We haven't been successful in preserving the state of the app when
>> we
>> >> >> get killed off, so I think singleTop is a really terrible idea until
>> >> >> we get state preservation solved, which is a really hard problem.
>> >> >>
>> >> >> On Fri, Feb 14, 2014 at 11:14 AM, Braden Shepherdson
>> >> >> <br...@chromium.org> wrote:
>> >> >>> I think singleTop is "not recommended" for typical Android apps,
>> that
>> >> >>> want
>> >> >>> to go opening different activities using various Intents from
>> >> >>> notifications. For something like Cordova, avoiding that restart is
>> >> >>> ideal.
>> >> >>>
>> >> >>> Braden
>> >> >>>
>> >> >>>
>> >> >>> On Fri, Feb 14, 2014 at 2:08 PM, Michal Mocny <mm...@google.com>
>> >> >>> wrote:
>> >> >>>
>> >> >>>> TLDR; AndroidManifest.xml <activity> needs:
>> >> >>>> android:launchMode="singleTop"
>> >> >>>> -- can I add it?
>> >> >>>>
>> >> >>>> Quick search brings up:
>> >> >>>>
>> >> >>>>
>> >>
>> http://stackoverflow.com/questions/10122449/phonegap-android-application-restarting-instead-of-resuming-although-it-was-not
>> >> >>>>
>> >> >>>> ..which advises to add android:launchMode="singleTask" to
>> >> >>>> AndroidManifest.xml <activity>, which does fix the issue.
>> >> >>>>
>> >> >>>> According to the descriptions in
>> >> >>>>
>> >>
>> http://developer.android.com/guide/topics/manifest/activity-element.htmlthe
>> >> >>>> differences mostly stem in how the app handles intents, however,
>> there
>> >> >>>> is a comment in the table of descriptions which labels singleTask
>> >> >>>> launchMode as  "(not recommended for general use)".
>> >> >>>>
>> >> >>>> On the other hand, singleTop mode *is* recommended, and also
>> fixes the
>> >> >>>> issue, and according to the description, sounds to me like a much
>> >> >>>> better
>> >> >>>> default.
>> >> >>>>
>> >> >>>> So, does anyone have a reason to not set
>> >> >>>> android:launchMode="singleTop" in
>> >> >>>> the default cordova-android platform template?
>> >> >>>>
>> >> >>>> I notice Simon commented on the above SO question, so I guess we
>> were
>> >> >>>> already aware of the issue a while ago.  Is there a conscious
>> reason
>> >> >>>> for
>> >> >>>> not setting that launchMode by default, or did this just slip
>> through
>> >> >>>> the
>> >> >>>> cracks?  Is there a known downside?
>> >> >>>>
>> >> >>>> -Michal
>> >> >>>>
>> >> >
>> >>
>> >>
>> >>
>>
>
>

Re: [Android] Apps restart instead of resume when brought to focus by clicking app icon

Posted by Michal Mocny <mm...@chromium.org>.
On Fri, Feb 14, 2014 at 5:26 PM, Joe Bowser <bo...@gmail.com> wrote:

> On Fri, Feb 14, 2014 at 12:28 PM, Michal Mocny <mm...@chromium.org>
> wrote:
> > Joe, I think you may have that backwards.  singleTop means we don't get
> get
> > restarted so avoid the issue of preserving state.  If we leave the
> > launchMode as the default, we *do* get killed off and lose state.
>
> Yeah, I did, which is why I changed my mind. :P
>
> We still should fix preserving state, and I'm not convinced that this
> is the right thing to do in all instances.
>
> >
> > Braden, if I understand what you say correct, singleTop is not good for
> > apps that have multiple activities which it launches conditionally
> > depending on incoming intent, but we do not so its a fine default?
> >
>
> We totally could have that, it depends on the plugin, which is why I
> propose that this be a config setting.
>

Okay, fair!  Is singleTop a good default, or should we leave it as standard
as it is now?


>
>
>
> > Bas, thanks for pointing that out.  Seems they advise same default
> > launchMode.
> >
> > -Michal
> >
> >
> > On Fri, Feb 14, 2014 at 3:01 PM, Bas Bosman <co...@nazgul.nu> wrote:
> >
> >> Just wanted to point out a Pull Request on a Phonegap Build plugin
> related
> >> to this subject:
> >> https://github.com/phonegap-build/PushPlugin/pull/149
> >>
> >> Don't have any expertise on the issue, but remembered reading this PR a
> >> few days ago.
> >>
> >> Bas
> >>
> >> > OK, I changed my mind after re-reading the docs once again.
> >> >
> >> > We should make this a configurable option ideally.  singleTop might
> >> > make sense for legacy webview apps, but I'd have to see the way that
> >> > we do WebView.  We still need to solve state preservation though.
> >> >
> >> > On Fri, Feb 14, 2014 at 11:20 AM, Joe Bowser <bo...@gmail.com>
> wrote:
> >> >> Agreed.  If we keep re-starting over and over again, we lose state.
> >> >> We haven't been successful in preserving the state of the app when we
> >> >> get killed off, so I think singleTop is a really terrible idea until
> >> >> we get state preservation solved, which is a really hard problem.
> >> >>
> >> >> On Fri, Feb 14, 2014 at 11:14 AM, Braden Shepherdson
> >> >> <br...@chromium.org> wrote:
> >> >>> I think singleTop is "not recommended" for typical Android apps,
> that
> >> >>> want
> >> >>> to go opening different activities using various Intents from
> >> >>> notifications. For something like Cordova, avoiding that restart is
> >> >>> ideal.
> >> >>>
> >> >>> Braden
> >> >>>
> >> >>>
> >> >>> On Fri, Feb 14, 2014 at 2:08 PM, Michal Mocny <mm...@google.com>
> >> >>> wrote:
> >> >>>
> >> >>>> TLDR; AndroidManifest.xml <activity> needs:
> >> >>>> android:launchMode="singleTop"
> >> >>>> -- can I add it?
> >> >>>>
> >> >>>> Quick search brings up:
> >> >>>>
> >> >>>>
> >>
> http://stackoverflow.com/questions/10122449/phonegap-android-application-restarting-instead-of-resuming-although-it-was-not
> >> >>>>
> >> >>>> ..which advises to add android:launchMode="singleTask" to
> >> >>>> AndroidManifest.xml <activity>, which does fix the issue.
> >> >>>>
> >> >>>> According to the descriptions in
> >> >>>>
> >>
> http://developer.android.com/guide/topics/manifest/activity-element.htmlthe
> >> >>>> differences mostly stem in how the app handles intents, however,
> there
> >> >>>> is a comment in the table of descriptions which labels singleTask
> >> >>>> launchMode as  "(not recommended for general use)".
> >> >>>>
> >> >>>> On the other hand, singleTop mode *is* recommended, and also fixes
> the
> >> >>>> issue, and according to the description, sounds to me like a much
> >> >>>> better
> >> >>>> default.
> >> >>>>
> >> >>>> So, does anyone have a reason to not set
> >> >>>> android:launchMode="singleTop" in
> >> >>>> the default cordova-android platform template?
> >> >>>>
> >> >>>> I notice Simon commented on the above SO question, so I guess we
> were
> >> >>>> already aware of the issue a while ago.  Is there a conscious
> reason
> >> >>>> for
> >> >>>> not setting that launchMode by default, or did this just slip
> through
> >> >>>> the
> >> >>>> cracks?  Is there a known downside?
> >> >>>>
> >> >>>> -Michal
> >> >>>>
> >> >
> >>
> >>
> >>
>

Re: [Android] Apps restart instead of resume when brought to focus by clicking app icon

Posted by Joe Bowser <bo...@gmail.com>.
On Fri, Feb 14, 2014 at 12:28 PM, Michal Mocny <mm...@chromium.org> wrote:
> Joe, I think you may have that backwards.  singleTop means we don't get get
> restarted so avoid the issue of preserving state.  If we leave the
> launchMode as the default, we *do* get killed off and lose state.

Yeah, I did, which is why I changed my mind. :P

We still should fix preserving state, and I'm not convinced that this
is the right thing to do in all instances.

>
> Braden, if I understand what you say correct, singleTop is not good for
> apps that have multiple activities which it launches conditionally
> depending on incoming intent, but we do not so its a fine default?
>

We totally could have that, it depends on the plugin, which is why I
propose that this be a config setting.



> Bas, thanks for pointing that out.  Seems they advise same default
> launchMode.
>
> -Michal
>
>
> On Fri, Feb 14, 2014 at 3:01 PM, Bas Bosman <co...@nazgul.nu> wrote:
>
>> Just wanted to point out a Pull Request on a Phonegap Build plugin related
>> to this subject:
>> https://github.com/phonegap-build/PushPlugin/pull/149
>>
>> Don't have any expertise on the issue, but remembered reading this PR a
>> few days ago.
>>
>> Bas
>>
>> > OK, I changed my mind after re-reading the docs once again.
>> >
>> > We should make this a configurable option ideally.  singleTop might
>> > make sense for legacy webview apps, but I'd have to see the way that
>> > we do WebView.  We still need to solve state preservation though.
>> >
>> > On Fri, Feb 14, 2014 at 11:20 AM, Joe Bowser <bo...@gmail.com> wrote:
>> >> Agreed.  If we keep re-starting over and over again, we lose state.
>> >> We haven't been successful in preserving the state of the app when we
>> >> get killed off, so I think singleTop is a really terrible idea until
>> >> we get state preservation solved, which is a really hard problem.
>> >>
>> >> On Fri, Feb 14, 2014 at 11:14 AM, Braden Shepherdson
>> >> <br...@chromium.org> wrote:
>> >>> I think singleTop is "not recommended" for typical Android apps, that
>> >>> want
>> >>> to go opening different activities using various Intents from
>> >>> notifications. For something like Cordova, avoiding that restart is
>> >>> ideal.
>> >>>
>> >>> Braden
>> >>>
>> >>>
>> >>> On Fri, Feb 14, 2014 at 2:08 PM, Michal Mocny <mm...@google.com>
>> >>> wrote:
>> >>>
>> >>>> TLDR; AndroidManifest.xml <activity> needs:
>> >>>> android:launchMode="singleTop"
>> >>>> -- can I add it?
>> >>>>
>> >>>> Quick search brings up:
>> >>>>
>> >>>>
>> http://stackoverflow.com/questions/10122449/phonegap-android-application-restarting-instead-of-resuming-although-it-was-not
>> >>>>
>> >>>> ..which advises to add android:launchMode="singleTask" to
>> >>>> AndroidManifest.xml <activity>, which does fix the issue.
>> >>>>
>> >>>> According to the descriptions in
>> >>>>
>> http://developer.android.com/guide/topics/manifest/activity-element.htmlthe
>> >>>> differences mostly stem in how the app handles intents, however, there
>> >>>> is a comment in the table of descriptions which labels singleTask
>> >>>> launchMode as  "(not recommended for general use)".
>> >>>>
>> >>>> On the other hand, singleTop mode *is* recommended, and also fixes the
>> >>>> issue, and according to the description, sounds to me like a much
>> >>>> better
>> >>>> default.
>> >>>>
>> >>>> So, does anyone have a reason to not set
>> >>>> android:launchMode="singleTop" in
>> >>>> the default cordova-android platform template?
>> >>>>
>> >>>> I notice Simon commented on the above SO question, so I guess we were
>> >>>> already aware of the issue a while ago.  Is there a conscious reason
>> >>>> for
>> >>>> not setting that launchMode by default, or did this just slip through
>> >>>> the
>> >>>> cracks?  Is there a known downside?
>> >>>>
>> >>>> -Michal
>> >>>>
>> >
>>
>>
>>

Re: [Android] Apps restart instead of resume when brought to focus by clicking app icon

Posted by Michal Mocny <mm...@chromium.org>.
Joe, I think you may have that backwards.  singleTop means we don't get get
restarted so avoid the issue of preserving state.  If we leave the
launchMode as the default, we *do* get killed off and lose state.

Braden, if I understand what you say correct, singleTop is not good for
apps that have multiple activities which it launches conditionally
depending on incoming intent, but we do not so its a fine default?

Bas, thanks for pointing that out.  Seems they advise same default
launchMode.

-Michal


On Fri, Feb 14, 2014 at 3:01 PM, Bas Bosman <co...@nazgul.nu> wrote:

> Just wanted to point out a Pull Request on a Phonegap Build plugin related
> to this subject:
> https://github.com/phonegap-build/PushPlugin/pull/149
>
> Don't have any expertise on the issue, but remembered reading this PR a
> few days ago.
>
> Bas
>
> > OK, I changed my mind after re-reading the docs once again.
> >
> > We should make this a configurable option ideally.  singleTop might
> > make sense for legacy webview apps, but I'd have to see the way that
> > we do WebView.  We still need to solve state preservation though.
> >
> > On Fri, Feb 14, 2014 at 11:20 AM, Joe Bowser <bo...@gmail.com> wrote:
> >> Agreed.  If we keep re-starting over and over again, we lose state.
> >> We haven't been successful in preserving the state of the app when we
> >> get killed off, so I think singleTop is a really terrible idea until
> >> we get state preservation solved, which is a really hard problem.
> >>
> >> On Fri, Feb 14, 2014 at 11:14 AM, Braden Shepherdson
> >> <br...@chromium.org> wrote:
> >>> I think singleTop is "not recommended" for typical Android apps, that
> >>> want
> >>> to go opening different activities using various Intents from
> >>> notifications. For something like Cordova, avoiding that restart is
> >>> ideal.
> >>>
> >>> Braden
> >>>
> >>>
> >>> On Fri, Feb 14, 2014 at 2:08 PM, Michal Mocny <mm...@google.com>
> >>> wrote:
> >>>
> >>>> TLDR; AndroidManifest.xml <activity> needs:
> >>>> android:launchMode="singleTop"
> >>>> -- can I add it?
> >>>>
> >>>> Quick search brings up:
> >>>>
> >>>>
> http://stackoverflow.com/questions/10122449/phonegap-android-application-restarting-instead-of-resuming-although-it-was-not
> >>>>
> >>>> ..which advises to add android:launchMode="singleTask" to
> >>>> AndroidManifest.xml <activity>, which does fix the issue.
> >>>>
> >>>> According to the descriptions in
> >>>>
> http://developer.android.com/guide/topics/manifest/activity-element.htmlthe
> >>>> differences mostly stem in how the app handles intents, however, there
> >>>> is a comment in the table of descriptions which labels singleTask
> >>>> launchMode as  "(not recommended for general use)".
> >>>>
> >>>> On the other hand, singleTop mode *is* recommended, and also fixes the
> >>>> issue, and according to the description, sounds to me like a much
> >>>> better
> >>>> default.
> >>>>
> >>>> So, does anyone have a reason to not set
> >>>> android:launchMode="singleTop" in
> >>>> the default cordova-android platform template?
> >>>>
> >>>> I notice Simon commented on the above SO question, so I guess we were
> >>>> already aware of the issue a while ago.  Is there a conscious reason
> >>>> for
> >>>> not setting that launchMode by default, or did this just slip through
> >>>> the
> >>>> cracks?  Is there a known downside?
> >>>>
> >>>> -Michal
> >>>>
> >
>
>
>

Re: [Android] Apps restart instead of resume when brought to focus by clicking app icon

Posted by Bas Bosman <co...@nazgul.nu>.
Just wanted to point out a Pull Request on a Phonegap Build plugin related
to this subject:
https://github.com/phonegap-build/PushPlugin/pull/149

Don't have any expertise on the issue, but remembered reading this PR a
few days ago.

Bas

> OK, I changed my mind after re-reading the docs once again.
>
> We should make this a configurable option ideally.  singleTop might
> make sense for legacy webview apps, but I'd have to see the way that
> we do WebView.  We still need to solve state preservation though.
>
> On Fri, Feb 14, 2014 at 11:20 AM, Joe Bowser <bo...@gmail.com> wrote:
>> Agreed.  If we keep re-starting over and over again, we lose state.
>> We haven't been successful in preserving the state of the app when we
>> get killed off, so I think singleTop is a really terrible idea until
>> we get state preservation solved, which is a really hard problem.
>>
>> On Fri, Feb 14, 2014 at 11:14 AM, Braden Shepherdson
>> <br...@chromium.org> wrote:
>>> I think singleTop is "not recommended" for typical Android apps, that
>>> want
>>> to go opening different activities using various Intents from
>>> notifications. For something like Cordova, avoiding that restart is
>>> ideal.
>>>
>>> Braden
>>>
>>>
>>> On Fri, Feb 14, 2014 at 2:08 PM, Michal Mocny <mm...@google.com>
>>> wrote:
>>>
>>>> TLDR; AndroidManifest.xml <activity> needs:
>>>> android:launchMode="singleTop"
>>>> -- can I add it?
>>>>
>>>> Quick search brings up:
>>>>
>>>> http://stackoverflow.com/questions/10122449/phonegap-android-application-restarting-instead-of-resuming-although-it-was-not
>>>>
>>>> ..which advises to add android:launchMode="singleTask" to
>>>> AndroidManifest.xml <activity>, which does fix the issue.
>>>>
>>>> According to the descriptions in
>>>> http://developer.android.com/guide/topics/manifest/activity-element.htmlthe
>>>> differences mostly stem in how the app handles intents, however, there
>>>> is a comment in the table of descriptions which labels singleTask
>>>> launchMode as  "(not recommended for general use)".
>>>>
>>>> On the other hand, singleTop mode *is* recommended, and also fixes the
>>>> issue, and according to the description, sounds to me like a much
>>>> better
>>>> default.
>>>>
>>>> So, does anyone have a reason to not set
>>>> android:launchMode="singleTop" in
>>>> the default cordova-android platform template?
>>>>
>>>> I notice Simon commented on the above SO question, so I guess we were
>>>> already aware of the issue a while ago.  Is there a conscious reason
>>>> for
>>>> not setting that launchMode by default, or did this just slip through
>>>> the
>>>> cracks?  Is there a known downside?
>>>>
>>>> -Michal
>>>>
>



Re: [Android] Apps restart instead of resume when brought to focus by clicking app icon

Posted by Joe Bowser <bo...@gmail.com>.
OK, I changed my mind after re-reading the docs once again.

We should make this a configurable option ideally.  singleTop might
make sense for legacy webview apps, but I'd have to see the way that
we do WebView.  We still need to solve state preservation though.

On Fri, Feb 14, 2014 at 11:20 AM, Joe Bowser <bo...@gmail.com> wrote:
> Agreed.  If we keep re-starting over and over again, we lose state.
> We haven't been successful in preserving the state of the app when we
> get killed off, so I think singleTop is a really terrible idea until
> we get state preservation solved, which is a really hard problem.
>
> On Fri, Feb 14, 2014 at 11:14 AM, Braden Shepherdson
> <br...@chromium.org> wrote:
>> I think singleTop is "not recommended" for typical Android apps, that want
>> to go opening different activities using various Intents from
>> notifications. For something like Cordova, avoiding that restart is ideal.
>>
>> Braden
>>
>>
>> On Fri, Feb 14, 2014 at 2:08 PM, Michal Mocny <mm...@google.com> wrote:
>>
>>> TLDR; AndroidManifest.xml <activity> needs: android:launchMode="singleTop"
>>> -- can I add it?
>>>
>>> Quick search brings up:
>>>
>>> http://stackoverflow.com/questions/10122449/phonegap-android-application-restarting-instead-of-resuming-although-it-was-not
>>>
>>> ..which advises to add android:launchMode="singleTask" to
>>> AndroidManifest.xml <activity>, which does fix the issue.
>>>
>>> According to the descriptions in
>>> http://developer.android.com/guide/topics/manifest/activity-element.htmlthe
>>> differences mostly stem in how the app handles intents, however, there
>>> is a comment in the table of descriptions which labels singleTask
>>> launchMode as  "(not recommended for general use)".
>>>
>>> On the other hand, singleTop mode *is* recommended, and also fixes the
>>> issue, and according to the description, sounds to me like a much better
>>> default.
>>>
>>> So, does anyone have a reason to not set android:launchMode="singleTop" in
>>> the default cordova-android platform template?
>>>
>>> I notice Simon commented on the above SO question, so I guess we were
>>> already aware of the issue a while ago.  Is there a conscious reason for
>>> not setting that launchMode by default, or did this just slip through the
>>> cracks?  Is there a known downside?
>>>
>>> -Michal
>>>

Re: [Android] Apps restart instead of resume when brought to focus by clicking app icon

Posted by Joe Bowser <bo...@gmail.com>.
Agreed.  If we keep re-starting over and over again, we lose state.
We haven't been successful in preserving the state of the app when we
get killed off, so I think singleTop is a really terrible idea until
we get state preservation solved, which is a really hard problem.

On Fri, Feb 14, 2014 at 11:14 AM, Braden Shepherdson
<br...@chromium.org> wrote:
> I think singleTop is "not recommended" for typical Android apps, that want
> to go opening different activities using various Intents from
> notifications. For something like Cordova, avoiding that restart is ideal.
>
> Braden
>
>
> On Fri, Feb 14, 2014 at 2:08 PM, Michal Mocny <mm...@google.com> wrote:
>
>> TLDR; AndroidManifest.xml <activity> needs: android:launchMode="singleTop"
>> -- can I add it?
>>
>> Quick search brings up:
>>
>> http://stackoverflow.com/questions/10122449/phonegap-android-application-restarting-instead-of-resuming-although-it-was-not
>>
>> ..which advises to add android:launchMode="singleTask" to
>> AndroidManifest.xml <activity>, which does fix the issue.
>>
>> According to the descriptions in
>> http://developer.android.com/guide/topics/manifest/activity-element.htmlthe
>> differences mostly stem in how the app handles intents, however, there
>> is a comment in the table of descriptions which labels singleTask
>> launchMode as  "(not recommended for general use)".
>>
>> On the other hand, singleTop mode *is* recommended, and also fixes the
>> issue, and according to the description, sounds to me like a much better
>> default.
>>
>> So, does anyone have a reason to not set android:launchMode="singleTop" in
>> the default cordova-android platform template?
>>
>> I notice Simon commented on the above SO question, so I guess we were
>> already aware of the issue a while ago.  Is there a conscious reason for
>> not setting that launchMode by default, or did this just slip through the
>> cracks?  Is there a known downside?
>>
>> -Michal
>>

Re: [Android] Apps restart instead of resume when brought to focus by clicking app icon

Posted by Braden Shepherdson <br...@chromium.org>.
I think singleTop is "not recommended" for typical Android apps, that want
to go opening different activities using various Intents from
notifications. For something like Cordova, avoiding that restart is ideal.

Braden


On Fri, Feb 14, 2014 at 2:08 PM, Michal Mocny <mm...@google.com> wrote:

> TLDR; AndroidManifest.xml <activity> needs: android:launchMode="singleTop"
> -- can I add it?
>
> Quick search brings up:
>
> http://stackoverflow.com/questions/10122449/phonegap-android-application-restarting-instead-of-resuming-although-it-was-not
>
> ..which advises to add android:launchMode="singleTask" to
> AndroidManifest.xml <activity>, which does fix the issue.
>
> According to the descriptions in
> http://developer.android.com/guide/topics/manifest/activity-element.htmlthe
> differences mostly stem in how the app handles intents, however, there
> is a comment in the table of descriptions which labels singleTask
> launchMode as  "(not recommended for general use)".
>
> On the other hand, singleTop mode *is* recommended, and also fixes the
> issue, and according to the description, sounds to me like a much better
> default.
>
> So, does anyone have a reason to not set android:launchMode="singleTop" in
> the default cordova-android platform template?
>
> I notice Simon commented on the above SO question, so I guess we were
> already aware of the issue a while ago.  Is there a conscious reason for
> not setting that launchMode by default, or did this just slip through the
> cracks?  Is there a known downside?
>
> -Michal
>