Hi
I've a new problem with Intel XDK. In my app, i need to catch Android's back button to link to a specific page or, better, to previous page. I've tried with addvirtualpage and back button event but nothing happened. In attachment i've attach my project. Find "funzioni.js" in www/include/funcioni.js. Move to respondeSing() and read the comment.
链接已复制
Furio,
There are several issues in your code. Perhaps they are affecting your access to the back button. For example:
setTimeout("chiudiPopUp()", 3000); You are passing the function as a string
some of your variables are used out of scope
Do you use JSHint?
If you get those fixed and are still seeing a problem, it could be related to your cordova version:
https://software.intel.com/en-us/forums/intel-xdk/topic/594374
Yes, this is my fault. I've passed the function like string because after i use string to test if app enter on function. So, modify setTimeout, clear the srcript and create another .js file only for "backbutton" event. ATM work fine but, there is a problem. When i navigate from mainpage (page when ajax print from php answer all coupon or filtered coupon) to coupon page (the page opened after the click on copun's link) and click backbutton to back to mainpage i need to click 2 times, first nothing happens, at second click addEventListener(...) catch my backbutton. Any type of answer? i attach the last project :)
Thx to all for previous answer,
Furio
Furio,
It is possible that you are not invoking the onDeviceReady() function because the "deviceready" listener statement is not inside a function. You may want to wrap that statement inside a function that is called automatically, like onLoad(), such as in the following (as shown in the Cordova documentation):
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// device APIs are available
//
function onDeviceReady() {
// Now safe to use device APIs
}
Also, I am still seeing 53 error messages. They may be affecting your results.
Pamela
There are 53 error because i'm using method that include only in index.html. Example, in my "funzioni.js" i've used ajax call to retrieve information from php, obv XDK say me that are some error because i've not included jquery library on that file.So, this isn't the problem, canu help me? Pamela i've sent to u (4/5 days ago) the zip of my proj to, can u answer ?
Thanks
have a nice day
yes , backbutton.js atm work well . The only problem is the first click. When I run the application , at first click (Android's backbutton ) Event BackButton not active , after the second click everything starts to work well .
Furio,
The back button event usually works pretty well with Android. I wonder if your backbutton.js code is either not listening for the event soon enough? Or maybe it is not fully processing the event the first time it catches it. Try debugging in the Debug tab - set breakpoints so that you can see what is happening and why the first event looks like it is being ignored.
Pamela