Is there a way for the app to know as soon as it starts running in the background on a phone?
Kind of. The window.onbeforeunload event is for that. I understand that it is not 100% reliable, however, so your mileage may vary.
There may also be a PhoneGap library which could help you.
Thanks. Unfortunately, i couldn’t get any of the window objects to work. I’ll keep trying!