[ 
https://issues.apache.org/jira/browse/CB-10614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15156220#comment-15156220
 ] 

Daniel Scott-Weekly commented on CB-10614:
------------------------------------------

Hey, sorry.

I can't give the full code. Basically on most of my pages I have

{code:borderStyle=solid}

window.onload = () => {
    console.log("Window loaded");
    document.addEventListener("deviceready", onDeviceReady, false);
};

function onDeviceReady() {
    document.removeEventListener("deviceready", onDeviceReady, false);
    document.addEventListener("backbutton", onBackKeyDown.bind(this), false);
}

function onBackKeyDown(event: Event){
    if(confirm("Are you sure you want to go back?")
    {
         cordova.exec(() => { },() => { }, "GamesPlugin", "GoBack", []);
    }
}

{code}

Then in java it finds where it should be going, then I swap page using.
{code:borderStyle=solid}
     this.webView.loadUrl("file:///" + oldURL);
{code}




> You can only override and use the back and volume buttons on one page per app 
> launch
> ------------------------------------------------------------------------------------
>
>                 Key: CB-10614
>                 URL: https://issues.apache.org/jira/browse/CB-10614
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 3.5.0
>         Environment: Visual Studio Tools for Apache Cordova
>            Reporter: Daniel Scott-Weekly
>            Priority: Minor
>              Labels: android
>
> When overriding the back or volume buttons on a page, after an event is 
> fired, the events will continue to go through the appPlugin, when you change 
> the page the appPlugin is no longer pointing to the correct page, so back 
> button events and volume events don't make it to the javascript.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to