This is a repost of an old post I wrote in July 2013 (pardon my English from back then, and the poor layout). It got a lot of traction and got people requesting for a repost. This is unfortunately not an updated post, but I’d be happy to answer questions if I can. Hopefully there are still some fair advice to learn from. Happy coding! —
Installing your application as a background service using phonegap is not easy and intuitive. This article will show you the easiest way to install your application as a service so that whatever the user will be doing with its phone, your app will always be running and execute the code you want even if your application is not in the foreground anymore. I’ll also give you more tips about keeping your phone awake (no sleep mode) and prevent the Android garbage collector from stopping your service.