How make the schedule task running repeatedly even the app killed or after rebooting

Hello everyone,

I am making an app which need to run a task in background regularly(let 's say every 10 mins), I can make it working using

setInterval(function () {
appRef.xxxMethod();
}, 10000);

It works when the app running or run in background mode, but my question is how to keep it running when the app closed or how I can re-active this regular task after rebooting phone?

I searched google and this forum, but I did not find solution.

What I can think is that I can make another standalone service without any UI and it is set up as auto-start when phone start. But the ugly thing is need to ask app user to install 2 apps, one is for UI app, another is for back-end service app.

I am very appreciated if any ideas, thanks.

1 Like