App version

App version

Hi... I have an app into app store and google play.
Sometimes I need to change the version of the app.
I want to develop a way to send an alert notification to the user when there is a new app version available (I'm using Jquery mobile + phonegap)

My idea:
Into the app (apk, ipa) maintain a variable with the version
Maintain a text file in the server with the current version

IF Current version (in the text file at the server) > Version (into the app) send an alert to the user

If the app is dormant (in the background) and it's activated I need to verifiy the text file in the server
I don't know which method i have to use in Jquery-mobile !!!
What's the method that is fired as soon as the app wake up from the background?

Regards,
Fernando