You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The back button event listener is not working after adding webview-plus plugin for android.
Steps to reproduce:
cocoonjs create backbuttontest
cd backbuttontest
cocoonjs platform add android
cocoonjs plugin add com.ludei.webview.plus
Edit www/js/index.js, add "document.addEventListener('backbutton', function(){alert("Back Button Pressed!");});" into onDeviceReady function so that it looks like this:
When the app is launched, press the back button and the app will exit without triggering the event listener.
However, if you launch the app, press the home button (to bring it to background), open the app again (from background), press the back button and the event listener will get triggered.
Am I doing something wrong or what?
The text was updated successfully, but these errors were encountered:
Navigate to:
\platforms\android\CordovaLib\src\org\apache\cordova\CordovaActivity.java
Add the following function into CordovaActivity Class: @OverRide
public void onBackPressed() {
appView.loadUrl("javascript:cordova.fireDocumentEvent('backbutton');");
}
Find and Comment the following function call (Not sure if this step is needed):
this.getWindow().getDecorView().requestFocus();
The back button event listener is not working after adding webview-plus plugin for android.
Steps to reproduce:
cocoonjs create backbuttontest
cd backbuttontest
cocoonjs platform add android
cocoonjs plugin add com.ludei.webview.plus
Edit www/js/index.js, add "document.addEventListener('backbutton', function(){alert("Back Button Pressed!");});" into onDeviceReady function so that it looks like this:
onDeviceReady: function() {
app.receivedEvent('deviceready');
document.addEventListener('backbutton', function(){alert("Back Button Pressed!");});
},
When the app is launched, press the back button and the app will exit without triggering the event listener.
However, if you launch the app, press the home button (to bring it to background), open the app again (from background), press the back button and the event listener will get triggered.
Am I doing something wrong or what?
The text was updated successfully, but these errors were encountered: