[ 
https://issues.apache.org/jira/browse/CB-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joe Bowser updated CB-1205:
---------------------------

    Fix Version/s: 2.1.0
    
> 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

        

Reply via email to