Return-Path: X-Original-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D38EAD9B5 for ; Fri, 17 Aug 2012 18:38:38 +0000 (UTC) Received: (qmail 61124 invoked by uid 500); 17 Aug 2012 18:38:38 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 60959 invoked by uid 500); 17 Aug 2012 18:38:38 -0000 Mailing-List: contact callback-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-dev@incubator.apache.org Received: (qmail 60687 invoked by uid 99); 17 Aug 2012 18:38:38 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Aug 2012 18:38:38 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 055802C5BE3 for ; Fri, 17 Aug 2012 18:38:38 +0000 (UTC) Date: Sat, 18 Aug 2012 05:38:38 +1100 (NCT) From: "Joe Bowser (JIRA)" To: callback-dev@incubator.apache.org Message-ID: <1241544293.24673.1345228718022.JavaMail.jiratomcat@arcas> In-Reply-To: <1958654504.20020.1344316142401.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Resolved] (CB-1205) backbutton event should not fire on 'subscribe' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Joe Bowser resolved CB-1205. ---------------------------- Resolution: Cannot Reproduce I was able to reproduce this last week, but I can't on the current version of the JS that I just built. This may have been fixed recently without this ticket being closed. > backbutton event should not fire on 'subscribe' > ----------------------------------------------- > > Key: CB-1205 > URL: https://issues.apache.org/jira/browse/CB-1205 > Project: Apache Cordova > Issue Type: Bug > Components: Android > Affects Versions: 1.8.1, 1.9.0, 2.0.0 > Reporter: Hugo > Assignee: Joe Bowser > Fix For: 2.1.0 > > > After the backbutton has been used once, it fires every time it is subscribed to. This is a pattern that may makes sense with certain events, but it is problematic in the android world where users will expect the backbutton to do different things depending on the context (typically, when on the home screen the backbutton means "exit the app", and on any other screen it means "go back to the previous screen"). > For developers to be able to implement this behavior, they need to be able to subscribe and unsubscribe the backbutton event without side-effect > The pseudo js to implement a normal android behavior is something like: > goPreviousScreen = function() { > // Do what you need to do to return to the previous screen > } > // When returning to the home screen, disable the cdv handler to enable the > // default behavior (exit the app & return to previous activity) > document.removeEventListener("backbutton", goPreviousScreen, false) ; > // When leaving the home screen > document.addEventListener("backbutton", goPreviousScreen, false) ; > // >> If the user exercised the backbutton once during the session > // >> he can never navigate from the home screen to another screen > // >> without being immediatly returned to the home screen > // >> because the 'backbutton' event fires on subscription > Note: this was tested & confirmed on 1.8.1, a cursory glance at the source for 1.9 and 2.0 strongly suggests that the problem affects these versions as well. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira