My problem is the following: When I try to track GPS location in the background it often forgets or removes the event listener and stops retrieving location updates.
I’ve put an Interval in my background services file to try and keep my service alive, I’ve set a frequency check, when the location hasn’t been called for more than 30 seconds, it removes and then adds the location event listener again. All of this does not make the application stay alive.
I’ve added the following settings in tiapp.xml, these are also shown in the capabilities tab in Xcode:
These are Geolocation settings I use:
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
Titanium.Geolocation.activityType = Titanium.Geolocation.ACTIVITYTYPE_FITNESS;
Titanium.Geolocation.distanceFilter = 7;
And the code to register the background service: