In my phonegap android application, i need to communicate with the server for every 1 sec. So I have tried with the sample code.
Here is my code:
var timeIntervalId = 0;
timeIntervalId = window.setInterval ( "onload1()", 1000 );
function onload1()
{
alert("hai");
}
It works fine when I am in the same page. But my problem is I need to call this timer function wherever I am in the whole application. Please Kindly Guide Me. Thanks in Advance.
I dont know about android but I here is my way that i can do in my web application…
simple solution is put this function in one javascript file and than form the
document.ready()method orwindows.loadmethod of page call this function….this will work for youor
you can put the code in the
doucment.ready()function and that put whole code in one javascript file and than include this javascript file in all pages will do your work ….doucment.ready()– is part of jQuery..