How to execute periodic tasks?

Hi,
I have to send periodically some data from the app to the server.

I’m using this code to start the sending:
this.timerSendDataToServer = setInterval(this.sendGeolocationDataToServer, 10000, this.device.getValue(), pageObject);

And this code to stop the sending:
clearInterval(this.timerSendDataToServer);

This code works testing the app with Chrome and deploying it on my Android phone.
However, on other devices, especially iOS, it doesn’t seem to work.
That is the trigger doesn’t start every 10 seconds.

So the question is, is this the best way to execute periodic tasks or there are better methods?

Thank you.

cld