I am working on a sencha touch application where I need to send request to server after every 1 min. I am using setInterval() & setTimeOut() both works in chrome on desktop but when it comes to iPhone or Android it don't work (they don't get called) Has anyone used these functions before (successfully) or any other functions to use.
Code used
setInterval(function(){
//server calling method
},10000);
setTimeout(function name,10000);
Function name is function which has code to send request to server.
Thank YOu
Why don't you Sencha's DelayedTask class for the purpose? It will be something like this:
//create the delayed task instance with our callback
var task = Ext.create('Ext.util.DelayedTask', function() {
//server calling method
// The task will be called after each 10000 ms
task.delay(10000);
}, this);
//The function will start after 0 milliseconds - so we want to start instantly at first
task.delay(0);
//to stop the task, just call the cancel method
//task.cancel();
And, I worked with this code with Phonegap and it worked fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With