Cordova-Windows UWP硬件后退按钮不起作用

Cordova-Windows UWP硬件后退按钮不起作用,cordova,Cordova,构建Cordova应用程序并在Windows上进行测试。在我的Windows phone上,“硬件后退”按钮不会触发Cordova的backbutton事件,这是应该的 我尝试了多种方法来捕捉事件,但迄今为止没有成功。有人知道答案吗 目前我拥有的代码如下: function onDeviceReady() { // This is supposed to capture the WinJS onbackclick event. if (WinJS) { WinJS.Application

构建Cordova应用程序并在Windows上进行测试。在我的Windows phone上,“硬件后退”按钮不会触发Cordova的backbutton事件,这是应该的

我尝试了多种方法来捕捉事件,但迄今为止没有成功。有人知道答案吗

目前我拥有的代码如下:

function onDeviceReady() {
// This is supposed to capture the WinJS onbackclick event.
if (WinJS) {
    WinJS.Application.onbackclick = function(e) {
        MyApp.app.navigationManager.back();
        // Return true otherwise it will close app.
        return true;
    }

}

function goBack(event) {
    // Here I handle going back
}
// This is how Cordova says you can listen to the event
document.addEventListener("backbutton", goBack(event), false);

// This is another method using a different method to try to capture the event
if (cordova.platformId == 'windows') {
    Windows.Phone.UI.Input.HardwareButtons.addEventListener("backpressed", goBack(event));
}
};
所有这些都不是捕获事件:应用程序总是挂起,而不是返回上一页