Geolocation + iOS + background mode = Fail

Hi guys can you save me from the project’s cliff.


I have a Ionic project based on Map template. What it does is tracking the walking route of user and draw it to google map.

Problem appears on iOS devices with background running. I cannot get the GPS data correctly.
FYI: BackgroundMode plugin installed and set up.

Scenario 1: Use cordova-plugin-geolocation plugin

It does not work. No GPS data collected when turning off screen.

Scenario 2: Use plain JS with navigator.geolocation.getCurrentPosition

It works. GPS data collected but not correct. Data is somehow duplicated (!!) from previous ones. Thing get back to normal when I open
the app again.

Any idea would help.

Plugins used:
cordova-plugin-background-mode 0.6.5
cordova-plugin-customurlscheme 4.1.5
cordova-plugin-device 1.1.1
cordova-plugin-geolocation 2.1.0
cordova-plugin-splashscreen 3.2.1
cordova-plugin-statusbar 2.1.2
cordova-plugin-whitelist 1.2.1
ionic-plugin-keyboard 2.0.1

Target platform?
iOS 7+, and Android 4.1+ as required by Ionic.

Test device iOS version?
iOS 9 on iPhone 5

Have you tested your App in the foreground?
Yes I do. To clarify, here is more detailed test:

I have two test functions: One array for gps collecting and one counter for background mode checking. Both are running under interval set.

(on iOS)
Counter works, number is increased.
GPS works, data is added to array.

Counter works, number is increased.
GPS not works, data is either not collected (with ngCordova geolocation plugin) or is oddly duplicated with JS navigator.geolocation

i was only in contact with this:

I was not part as a developer only as someone outstanding with a little eye on the ionic development. but they used this plugin for tracking of shippings around the world… so i think this should also work in background mode. but it costs.

You have to fulfill strict standards to be allowed to handle background tasks on iOS! So i think the most of the plugins does not fullfil the requirements.