Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BFBAE10652 for ; Sat, 15 Feb 2014 13:42:49 +0000 (UTC) Received: (qmail 60602 invoked by uid 500); 15 Feb 2014 13:42:49 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 60267 invoked by uid 500); 15 Feb 2014 13:42:48 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 60259 invoked by uid 99); 15 Feb 2014 13:42:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Feb 2014 13:42:48 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mmocny@google.com designates 209.85.128.173 as permitted sender) Received: from [209.85.128.173] (HELO mail-ve0-f173.google.com) (209.85.128.173) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Feb 2014 13:42:42 +0000 Received: by mail-ve0-f173.google.com with SMTP id jw12so3361229veb.18 for ; Sat, 15 Feb 2014 05:42:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=2xnat1Ptot0c0YieQ5K1Kw8l99UQ0aGYun/UvpkJzyY=; b=AyxTM1irKYU/a3iDPgTsXZ3P4BWRep6pgUQxi+2OpVFOa2sbdqayxVy3wid1I1sXJx oKlnjr6v4xd3rBcOTJuVTD01lTYTSs2r7JZVllY6KPIn9Y2a14WIvH+3Ivm6KkZq9SsR 15SfxZyPPS3+XDxpbxh3MNQsslw+gDA5qkijIt9Ajs0n42XAoLaw8wqWfOwv9uyDM2IF 7ippMXC+kiypJIfndA1jqL8c/uz6EYuB1ju88jTlQkxl/tHB+pVPLBcZ8KfasZkulonB jxzOmnxTBMFw5HoHONH0UwL9IFzlJ9/tNF4nQRgAp28CIAyGYNzfHE54PTs6P/J88PTF TBLw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=2xnat1Ptot0c0YieQ5K1Kw8l99UQ0aGYun/UvpkJzyY=; b=iFkcRsSxbqbTOhvUw7AXBy6ODOPXGLfFW9xFXCe81oHUty67GK3PzO+BgKr5HmP8aZ 7ayBX0OUU0R8rHRIWbYZEYsmDZmZuSEch3VLGLnxgaW480qV1oM/NFelaCV59jpl6AGI KrZrCIs8NiulJUmJ/phbQRCfX1BDkqZeqzbMc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=2xnat1Ptot0c0YieQ5K1Kw8l99UQ0aGYun/UvpkJzyY=; b=Gt0T2AXt0lavPRozhodCfNeYKiPKz7d47ED1/Rk5vq6roDKXMcsdClHeBR6pu/H5eR EyNPXeWIPllnBucPVn1oCiO8HaXMmMzuinhtMPnVqn6JjEfhLCBUvmmAofmP5WamcB58 U/zveIP3/EkbLJJFLqKbeUNpgUwC92pahGqOXyOSKC61GsAXpz+OyexXtI/7OAhhEHop dwKXUeaDTuB8Tc5Yf/8P13espQHFO1xOAijWTFo/lHchedsIzTZdd9SE5hYvMjYMwAXU t/bUCLWXwfxB7tTCsEtPFEOyH1YbHw/t2b1S6Fey+qw3XC1NwO9f1t1HMUUAC/IVF035 dUxA== X-Gm-Message-State: ALoCoQl9MrWDB1uyNxaes4Rc9iEvW6jFQp9cQLPRRnAQdb4zGhTF/bZ3T6LeYzldxEB6kDsttjozsI7oKcupHWd11yZM/HR0IRAEZxg9+oVanox28VUiK4HVUYjeDxm1DDZeXo1DyWKEAGnOm7U+mppAiF3VdO956L17vNxIm8mBHcH/uZAIKlJqszIN1zfY5foz6mPfM0B4pf/heF8z6Y4xpBBi96YU8w== X-Received: by 10.52.117.115 with SMTP id kd19mr7892236vdb.15.1392471741311; Sat, 15 Feb 2014 05:42:21 -0800 (PST) MIME-Version: 1.0 Sender: mmocny@google.com Received: by 10.52.227.165 with HTTP; Sat, 15 Feb 2014 05:42:01 -0800 (PST) In-Reply-To: References: <9e8e3989cc8b59c641f3d16ff6566d66.squirrel@webmail2.colokoe.net> From: Michal Mocny Date: Sat, 15 Feb 2014 08:42:01 -0500 X-Google-Sender-Auth: 1Z6Ku6sxm_3ur6FqPcMCyi4aoi4 Message-ID: Subject: Re: [Android] Apps restart instead of resume when brought to focus by clicking app icon To: Michal Mocny Cc: dev Content-Type: multipart/alternative; boundary=bcaec547c7dd80401e04f2721772 X-Virus-Checked: Checked by ClamAV on apache.org --bcaec547c7dd80401e04f2721772 Content-Type: text/plain; charset=UTF-8 CB-6048 On Sat, Feb 15, 2014 at 8:39 AM, Michal Mocny wrote: > > > > On Fri, Feb 14, 2014 at 5:26 PM, Joe Bowser wrote: > >> On Fri, Feb 14, 2014 at 12:28 PM, Michal Mocny >> 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 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 >> 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 >> >> >> 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 >> >> >>> wrote: >> >> >>> >> >> >>>> TLDR; AndroidManifest.xml 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 , 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 >> >> >>>> >> >> > >> >> >> >> >> >> >> > > --bcaec547c7dd80401e04f2721772--