First you need to have your app on the phone using phonegap. This is not the same as an hybrid app because this app is unable to retrieve the geolocation of the phone. You need to have developer accounts for the google, apple or microsoft systems and created the phonegap apps.
Second you need this app from the appstore: https://appstore.home.mendix.com/link/app/1380/Mendix/Geolocation-for-PhoneGap With this odule you can retrieve the geolocation. I am not sure if you could poll this mechanisme if the phone is sleeping.