- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am glad you have made progress.
Maybe if you fix some of the other errors - "out of scope", "missing semicolon", etc. - it will be easier to find your remaining problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I looked at your code. Is the onDeviceReady() function actually being called? (See my post from Monday.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It sounds like you are debugging in the emulator tab. Debugging in the debug tab gives you more functionality, you can set breakpoints and step through the execution. Try that.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page