transistorsoft / cordova-background-geolocation-lt

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
http://www.transistorsoft.com/shop/products/cordova-background-geolocation
Other
655 stars 277 forks source link

App restarts on iPhone XS (iOS 12) during background tracking #800

Closed Mike1707 closed 4 years ago

Mike1707 commented 5 years ago

Your Environment

Cordova:

cordova (Cordova CLI) : 8.1.1 (cordova-lib@8.1.0) Cordova Platforms : ios 4.5.5 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.1.4, (and 12 other plugins)

System:

Android SDK Tools : 26.1.1 (/Users/mike/Library/Android/sdk) ios-deploy : 2.0.0 NodeJS : v10.11.0 (/Users/mike/.nvm/versions/node/v10.11.0/bin/node) npm : 6.4.1 OS : macOS Xcode : Xcode 10.0 Build version 10A255


* Plugin config:

// Geolocation Options private desiredAccuracy = 0; private distanceFilter = 5; private disableElasticity = false; private elasticityMultiplier = 1; private stopAfterElapsedMinutes = 0; private stopOnStationary = false; private desiredOdometerAccuracy = 15;

// Geolocation iOS Options private stationaryRadius = 25; private useSignificantChangesOnly = false; private locationAuthorizationRequest = 'Always'; private locationAuthorizationAlert: object = { titleWhenNotEnabled: 'Foo.', titleWhenOff: 'Foo.', instructions: 'Foo!', cancelButton: 'Abbrechen', settingsButton: 'Einstellungen', }; private disableLocationAuthorizationAlert = false;

// Geolocation Android Options private locationUpdateInterval = 1000; private fastestLocationUpdateInterval = 1000; private deferTime = 0; private allowIdenticalLocations = false;

// Activity Recognition Options private activityRecognitionInterval = 60000; private stopTimeout = 15; private minimumActivityRecognitionConfidence = 75; private stopDetectionDelay = 0; private disableStopDetection = false;

// Activity Recognition iOS Options private activityType = 1; private disableMotionActivityUpdates = false;

// HTTP & Persistence Options private autoSync = false; private autoSyncThreshold = 0; private batchSync = false; private maxBatchSize = -1; private maxRecordsToPersist = 0;

// Application Options private stopOnTerminate = true; private startOnBoot = false; private heartbeatInterval = 60;

// Application iOS Options private preventSuspend = true;

// Application Android Options private foregroundService = true; private enableHeadless = false; private notificationText = 'MyApp GPS Service aktiv'; private forceReloadOnMotionChange = false; private forceReloadOnLocationChange = false; private forceReloadOnHeartbeat = false; private forceReloadOnBoot = false;

// Logging & Debug Options private debug = false; private logLevel = 5; // 0 off, 1 error, 2 warning, 3 info, 4 debug, 5 verbose private logMaxDays = 3;


## Expected Behavior
Like on my other iOS devices (iPhone SE, 6, 7) the app should stay alive in background mode to track the route and not restart. I use the aggressive tracking to print the user's exact walks on a map in foreground and background mode.

## Actual Behavior
After a short while, after opening the app which was in background mode (iPhone was locked), the app starts from scratch and the location tracking ended.

## Context
Downgrading to Uiwebview works better but the app restarts after a while again (after ~3km tracking). Downside: With Uiwebview the app is a way less efficient and needs much more memory.

## Debug logs

2018-10-02 10:43:36.345768+0200 MyAppTestDev[461:18010] Apache Cordova native platform version 4.5.5 is starting. 2018-10-02 10:43:36.346194+0200 MyAppTestDev[461:18010] Multi-tasking -> Device: YES, App: YES 2018-10-02 10:43:36.353743+0200 MyAppTestDev[461:18010] CDVWKWebViewEngine: trying to inject XHR polyfill 2018-10-02 10:43:36.432249+0200 MyAppTestDev[461:18010] CDVWKWebViewEngine will reload WKWebView if required on resume 2018-10-02 10:43:36.432330+0200 MyAppTestDev[461:18010] Using Ionic WKWebView 2018-10-02 10:43:36.433104+0200 MyAppTestDev[461:18010] [CDVTimer][console] 0.154018ms 2018-10-02 10:43:36.433264+0200 MyAppTestDev[461:18010] [CDVTimer][handleopenurl] 0.079989ms 2018-10-02 10:43:36.434692+0200 MyAppTestDev[461:18010] [CDVTimer][intentandnavigationfilter] 1.402020ms 2018-10-02 10:43:36.434743+0200 MyAppTestDev[461:18010] [CDVTimer][gesturehandler] 0.030041ms 2018-10-02 10:43:36.438439+0200 MyAppTestDev[461:18010] [CDVTimer][splashscreen] 3.678083ms 2018-10-02 10:43:36.440395+0200 MyAppTestDev[461:18010] [CDVTimer][statusbar] 1.912951ms 2018-10-02 10:43:36.459249+0200 MyAppTestDev[461:18010] [CDVTimer][file] 18.816948ms 2018-10-02 10:43:36.459343+0200 MyAppTestDev[461:18010] CDVIonicKeyboard: resize mode 3 2018-10-02 10:43:36.460000+0200 MyAppTestDev[461:18010] [CDVTimer][keyboard] 0.674009ms 2018-10-02 10:43:36.460100+0200 MyAppTestDev[461:18010] [CDVTimer][backgroundfetch] 0.051975ms 2018-10-02 10:43:36.460116+0200 MyAppTestDev[461:18010] [CDVTimer][TotalPluginStartup] 27.264953ms 2018-10-02 10:43:36.791548+0200 MyAppTestDev[461:18010] Ionic Native: deviceready event fired after 138 ms 2018-10-02 10:43:41.707608+0200 MyAppTestDev[461:18010] ERROR Internal navigation rejected - not set for url='about:blank' ℹ️-[TSLocationManager init] { activityRecognitionInterval = 60000; activityType = 1; autoSync = 0; autoSyncThreshold = 0; batchSync = 0; debug = 0; desiredAccuracy = "-1"; desiredOdometerAccuracy = 15; disableElasticity = 0; disableLocationAuthorizationAlert = 0; disableMotionActivityUpdates = 0; disableStopDetection = 0; distanceFilter = 5; elasticityMultiplier = 1; enabled = 1; extras = { }; geofenceInitialTriggerEntry = 1; geofenceProximityRadius = 1000; geofenceTemplate = ""; headers = { }; heartbeatInterval = 60; httpRootProperty = location; httpTimeout = 60000; isFirstBoot = 0; isMoving = 1; lastLocationAuthorizationStatus = 3; locationAuthorizationAlert = { cancelButton = Abbrechen; instructions = "Foo!"; settingsButton = Einstellungen; titleWhenNotEnabled = "Foo."; titleWhenOff = "Foo."; }; locationAuthorizationRequest = Always; locationTemplate = ""; locationTimeout = 60; locationsOrderDirection = ASC; logLevel = 5; logMaxDays = 3; maxBatchSize = "-1"; maxDaysToPersist = 1; maxRecordsToPersist = 0; method = POST; minimumActivityRecognitionConfidence = 75; odometer = "10931.38323042507"; params = { }; pausesLocationUpdatesAutomatically = 0; preventSuspend = 1; schedule = ( ); schedulerEnabled = 0; startOnBoot = 0; stationaryRadius = 25; stopAfterElapsedMinutes = 0; stopDetectionDelay = 0; stopOnStationary = 0; stopOnTerminate = 1; stopTimeout = 15; trackingMode = 1; url = ""; useSignificantChangesOnly = 0; } ✅-[LocationDAO unlock]_block_invoke UNLOCKED ALL RECORDS ℹ️-[GeofenceDAO init] CREATE TABLE IF NOT EXISTS geofences (id INTEGER PRIMARY KEY AUTOINCREMENT, identifier TEXT NOT NULL UNIQUE, latitude DOUBLE NOT NULL, sin_latitude DOUBLE NOT NULL, cos_latitude DOUBLE NOT NULL, longitude DOUBLE NOT NULL, sin_longitude DOUBLE NOT NULL, cos_longitude DOUBLE NOT NULL, radius DOUBLE NOT NULL, notifyOnEntry BOOLEAN NOT NULL DEFAULT 0, notifyOnExit BOOLEAN NOT NULL DEFAULT 0, notifyOnDwell BOOLEAN NOT NULL DEFAULT 0, loiteringDelay DOUBLE NOT NULL DEFAULT 0, extras TEXT) ℹ️-[GeofenceDAO init] CREATE index IF NOT EXISTS identifier ON geofences (identifier);CREATE index IF NOT EXISTS latitude ON geofences (latitude);CREATE index IF NOT EXISTS longitude ON geofences (longitude);CREATE index IF NOT EXISTS sin_latitude ON geofences (sin_latitude);CREATE index IF NOT EXISTS cos_latitude ON geofences (cos_latitude);CREATE index IF NOT EXISTS sin_longitude ON geofences (sin_longitude);CREATE index IF NOT EXISTS cos_longitude ON geofences (cos_longitude);

Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState] PID: 461, TID: 18217, Thread name: com.apple.CoreMotion.MotionThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0 Backtrace: 4 libobjc.A.dylib 0x0000000192737894 + 56 5 CoreMotion 0x0000000198f987a4 CoreMotion + 305060 6 CoreMotion 0x0000000198f98cd8 CoreMotion + 306392 7 CoreMotion 0x0000000198f98be8 CoreMotion + 306152 8 CoreMotion 0x0000000198fca3cc CoreMotion + 508876 9 CoreMotion 0x0000000198fca42c CoreMotion + 508972 10 CoreFoundation 0x00000001934d0888 + 28 11 CoreFoundation 0x00000001934d016c + 276 12 CoreFoundation 0x00000001934caf54 + 1016 13 CoreFoundation 0x00000001934ca844 CFRunLoopRunSpecific + 452 14 CoreFoundation 0x00000001934cb5a8 CFRunLoopRun + 84 15 CoreMotion 0x0000000198fc9d64 CoreMotion + 507236 16 libsystem_pthread.dylib 0x0000000193145a04 + 132 17 libsystem_pthread.dylib 0x0000000193145960 _pthread_start + 52 18 libsystem_pthread.dylib 0x000000019314ddf4 thread_start + 4 2018-10-02 10:43:41.771411+0200 MyAppTestDev[461:18217] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState] PID: 461, TID: 18217, Thread name: com.apple.CoreMotion.MotionThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0 Backtrace: 4 libobjc.A.dylib 0x0000000192737894 + 56 5 CoreMotion 0x0000000198f987a4 CoreMotion + 305060 6 CoreMotion 0x0000000198f98cd8 CoreMotion + 306392 7 CoreMotion 0x0000000198f98be8 CoreMotion + 306152 8 CoreMotion 0x0000000198fca3cc CoreMotion + 508876 9 CoreMotion 0x0000000198fca42c CoreMotion + 508972 10 CoreFoundation 0x00000001934d0888 + 28 11 CoreFoundation 0x00000001934d016c + 276 12 CoreFoundation 0x00000001934caf54 + 1016 13 CoreFoundation 0x00000001934ca844 CFRunLoopRunSpecific + 452 14 CoreFoundation 0x00000001934cb5a8 CFRunLoopRun + 84 15 CoreMotion 0x0000000198fc9d64 CoreMotion + 507236 16 libsystem_pthread.dylib 0x0000000193145a04 + 132 17 libsystem_pthread.dylib 0x0000000193145960 _pthread_start + 52 18 libsystem_pthread.dylib 0x000000019314ddf4 thread_start + 4 ℹ️-[TSLocationManager on:success:failure:] location ℹ️-[TSLocationManager on:success:failure:] motionchange ℹ️-[TSLocationManager on:success:failure:] heartbeat ℹ️-[TSConfig persist] ℹ️-[TSConfig persist] 🔵-[TSLocationManager ready] ℹ️-[TSLocationManager doStart:] trackingMode: 1 🎾-[TSGeofenceManager start] 🎾-[SOMotionDetector startDetection] 🔵-[TSLocationManager setPace:] 0 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON 2018-10-02 10:43:41.881837+0200 MyAppTestDev[461:18010] THREAD WARNING: ['BackgroundGeolocation'] took '18.721924' ms. Plugin should use a background thread. 2018-10-02 10:43:41.882109+0200 MyAppTestDev[461:18010] ERROR Internal navigation rejected - not set for url='about:blank' 🔵-[TSLocationManager locationManager:didChangeAuthorizationStatus:] status 3 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON 🔵-[BackgroundTaskManager locationManager:didChangeAuthorizationStatus:] 3 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 3 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 3 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 3 ✅-[SOMotionDetector startDetection]_block_invoke Enabled M7 MotionActivity updates ℹ️+[LocationAuthorization run:] status: 3 2018-10-02 10:43:41.889889+0200 MyAppTestDev[461:18010] [TSBackgroundFetch addListener]: TSLocationManager 2018-10-02 10:43:41.889913+0200 MyAppTestDev[461:18010] [TSBackgroundFetch start] 🎾-[TSLocationManager startMonitoringBackgroundFetch] BackgroundFetch: ON ℹ️+[LocationAuthorization run:] status: 3

📍<+52.01956960,+8.52757570> +/- 65.00m (speed -1.00 mps / course -1.00) @ 02.10.18, 10:43:27 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 14.4s ╚═══════════════════════════════════════════════════════════ ℹ️-[TSLocationManager locationManager:didUpdateLocations:] Received stale motionchange location. Retrying...

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1 ╚═══════════════════════════════════════════════════════════ ⚠️-[TSLocationManager start] Already started (ignored) ℹ️-[TSConfig persist] 🔵-[TSLocationManager changePace:] isMoving: 1 🔵-[TSLocationManager setPace:] 1 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON ℹ️+[LocationAuthorization run:] status: 3

📍<+52.01956960,+8.52757570> +/- 65.00m (speed -1.00 mps / course -1.00) @ 02.10.18, 10:43:36 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: -1.0m | age: 5.4s ╚═══════════════════════════════════════════════════════════ ℹ️-[TSLocationManager locationManager:didUpdateLocations:] Received stale motionchange location. Retrying...

📍<+52.01961319,+8.52786805> +/- 131.32m (speed -1.00 mps / course -1.00) @ 02.10.18, 10:43:42 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: -1.0m | age: 0.0s ╚═══════════════════════════════════════════════════════════ ✅-[TSLocationManager locationManager:didUpdateLocations:] Acquired motionchange position: <+52.01956960,+8.52757570> +/- 65.00m (speed -1.00 mps / course -1.00) @ 02.10.18, 10:43:36 Mitteleuropäische Sommerzeit 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 65.0 🎾-[TSLocationManager startMonitoringSignificantLocationChanges] ℹ️+[LocationAuthorization run:] status: 3

📍<+52.01955647,+8.52761352> +/- 65.00m (speed -1.00 mps / course -1.00) @ 02.10.18, 10:43:42 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.0s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 65.0 2018-10-02 10:43:43.433113+0200 MyAppTestDev[461:18010] CDVWKWebViewEngine: handleStopScroll 🔵-[TSLocationManager onSuspend:] enabled? 1) ℹ️-[TSDBLogger db_save] Log committed

📍<+52.01953035,+8.52748323> +/- 65.00m (speed -1.00 mps / course -1.00) @ 02.10.18, 10:43:48 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.0s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 65.0

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/66 | isMoving: 1 ╚═══════════════════════════════════════════════════════════

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/66 | isMoving: 1 ╚═══════════════════════════════════════════════════════════

📍<+52.01951055,+8.52741070> +/- 65.00m (speed -1.00 mps / course -1.00) @ 02.10.18, 10:43:54 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.0s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 65.0

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | running/100 | isMoving: 1 ╚═══════════════════════════════════════════════════════════

📍<+52.01954397,+8.52748276> +/- 65.00m (speed -1.00 mps / course -1.00) @ 02.10.18, 10:44:00 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.0s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 65.0

📍<+52.01958566,+8.52733690> +/- 39.67m (speed 0.51 mps / course 17.95) @ 02.10.18, 10:44:05 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.0s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 65.0

📍<+52.01959670,+8.52729442> +/- 33.10m (speed 0.23 mps / course 137.55) @ 02.10.18, 10:44:08 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.0s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 65.0

📍<+52.01958727,+8.52730209> +/- 26.71m (speed 0.47 mps / course 209.44) @ 02.10.18, 10:44:11 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.0s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 65.0

📍<+52.01960632,+8.52726814> +/- 21.27m (speed 0.92 mps / course 250.09) @ 02.10.18, 10:44:16 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.0s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 65.0

📍<+52.01963929,+8.52733858> +/- 19.60m (speed 0.95 mps / course 0.06) @ 02.10.18, 10:44:21 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.0s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 52.3 2018-10-02 10:44:21.405027+0200 MyAppTestDev[461:18587] [ProcessSuspension] 0x281f0eb40 - ProcessAssertion() Unable to acquire assertion for process with PID 0

📍<+52.01962686,+8.52726557> +/- 14.52m (speed 0.92 mps / course 310.30) @ 02.10.18, 10:44:30 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.2s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 39.7 ℹ️-[TSConfig persist] 🔵-[TSConfig incrementOdometer:] 10946.5 2018-10-02 10:44:32.555353+0200 MyAppTestDev[461:18010] Ionic Native: deviceready event fired after 715 ms

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/33 | isMoving: 0 ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager startMotionTriggerTimer] Motion-trigger timer engaged: Stop-detection will trigger in 60 seconds...

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | running/100 | isMoving: 1 ╚═══════════════════════════════════════════════════════════ ℹ️-[TSLocationManager resetMotionTriggerTimer]

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/66 | isMoving: 1 ╚═══════════════════════════════════════════════════════════

📍<+52.01968091,+8.52729082> +/- 13.70m (speed 1.69 mps / course 353.24) @ 02.10.18, 10:44:36 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.2s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 33.1 ℹ️-[TSConfig persist] 🔵-[TSConfig incrementOdometer:] 10952.7

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/33 | isMoving: 0 ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager startMotionTriggerTimer] Motion-trigger timer engaged: Stop-detection will trigger in 60 seconds...

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1 ╚═══════════════════════════════════════════════════════════ ℹ️-[TSLocationManager resetMotionTriggerTimer]

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1 ╚═══════════════════════════════════════════════════════════

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1 ╚═══════════════════════════════════════════════════════════

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/33 | isMoving: 0 ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager startMotionTriggerTimer] Motion-trigger timer engaged: Stop-detection will trigger in 60 seconds...

📍<+52.01966037,+8.52735748> +/- 24.53m (speed 0.85 mps / course 3.96) @ 02.10.18, 10:44:44 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.2s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 26.7 ℹ️-[TSDBLogger db_save] Log committed

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1 ╚═══════════════════════════════════════════════════════════ ℹ️-[TSLocationManager resetMotionTriggerTimer]

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/33 | isMoving: 0 ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager startMotionTriggerTimer] Motion-trigger timer engaged: Stop-detection will trigger in 60 seconds... 2018-10-02 10:44:51.428060+0200 MyAppTestDev[461:18010] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1 ╚═══════════════════════════════════════════════════════════ ℹ️-[TSLocationManager resetMotionTriggerTimer]

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/33 | isMoving: 0 ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager startMotionTriggerTimer] Motion-trigger timer engaged: Stop-detection will trigger in 60 seconds...

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1 ╚═══════════════════════════════════════════════════════════ ℹ️-[TSLocationManager resetMotionTriggerTimer]

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/33 | isMoving: 0 ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager startMotionTriggerTimer] Motion-trigger timer engaged: Stop-detection will trigger in 60 seconds...

📍<+52.01962679,+8.52742078> +/- 44.88m (speed 0.78 mps / course 49.91) @ 02.10.18, 10:44:58 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.2s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 26.7

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1 ╚═══════════════════════════════════════════════════════════ ℹ️-[TSLocationManager resetMotionTriggerTimer] 2018-10-02 10:45:01.803206+0200 MyAppTestDev[461:18010] CDVWKWebViewEngine shouldReloadWebView:: 2018-10-02 10:45:01.803382+0200 MyAppTestDev[461:18010] CDVWKWebViewEngine shouldReloadWebView title: MyApp 2018-10-02 10:45:01.803414+0200 MyAppTestDev[461:18010] CDVWKWebViewEngine shouldReloadWebView location: http://localhost:8080/#/tabs/tab-1/gassi-walks 2018-10-02 10:45:01.803436+0200 MyAppTestDev[461:18010] CDVWKWebViewEngine shouldReloadWebView reload: 0 🔵-[TSLocationManager onResume:] enabled? 1 ℹ️-[LocationDAO purge:] 1 ℹ️-[TSDBLogger db_save] Log committed

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/33 | isMoving: 0 ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager startMotionTriggerTimer] Motion-trigger timer engaged: Stop-detection will trigger in 60 seconds...

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1 ╚═══════════════════════════════════════════════════════════ ℹ️-[TSLocationManager resetMotionTriggerTimer]

📍<+52.01967531,+8.52745164> +/- 55.78m (speed 0.87 mps / course 32.99) @ 02.10.18, 10:45:06 Mitteleuropäische Sommerzeit

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 5.0m | age: 0.2s ╚═══════════════════════════════════════════════════════════ 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 26.7

christocracy commented 5 years ago

iOS doesn't keep apps alive in the background. You can assume that after some time idle in the background, the OS will terminate your app to free up memory for other apps.

Also, don't use cordova-plugin-ionic-webview. That plugin is known to white-screen your app when OS boots it in the background.

Mike1707 commented 5 years ago

Hey Chris, thanks for your reply.

Do you have any ideas why the app is working for hours in background on e.g. iPhone 7 and just a few seconds on iPhone X? That seems kind of extreme for me. Also, there are in the logs some lines which look weired:

2018-10-02 10:43:41.707608+0200 MyAppTestDev[461:18010] ERROR Internal navigation rejected - <allow-navigation> not set for url='about:blank'
2018-10-02 10:44:21.405027+0200 MyAppTestDev[461:18587] [ProcessSuspension]  0x281f0eb40 - ProcessAssertion() Unable to acquire assertion for process with PID 0
2018-10-02 10:44:51.428060+0200 MyAppTestDev[461:18010] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service

Could that be an indicator why the background time is so extremely different on my devices? Is there any chance to make it working for at least one hour in background mode?

Thanks in advance Mike

Edit: Do you have a recommendation for an alternative for cordova-plugin-ionic-webview? Just the Uiwebview (seems to be so old and outdated for me - Apple announced WkWebView for iOS 8 if I remember it right)?

christocracy commented 5 years ago

Do you have any ideas why the app is working for hours in background on e.g. iPhone 7 and just a few seconds on iPhone X?

webview plugin. The developers of that plugin completely fail to take account of the case where apps might stay alive or get re-launched in the background.

Also, there are in the logs some lines which look weired:

No idea.

My primary iOS development device is an iPhone X. I had these issues before I removed the webview plugin.

Do you have a recommendation for an alternative for cordova-plugin-ionic-webview

No. Just get rid of it.

There's a dedicated tag "webview" in the issues, specifically for this.

Mike1707 commented 5 years ago

Okay, I will give it a try. Is there any other known plugin which can bring up problems? My actual plugin list looks as follows:

cordova-background-geolocation-lt 2.13.2 "BackgroundGeolocation"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-background-fetch 5.4.1 "CDVBackgroundFetch"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-cocoalumberjack 0.0.4 "CocoaLumberjack"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-google-analytics 1.8.6 "Google Universal Analytics Plugin"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 2.1.4 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
Mike1707 commented 5 years ago

Hi @christocracy

Today I found an entry on the github page of the cordova-plugin-ionic-webview for background mode. It seems they added some new functionality. Do you think this might be a solution for the issues with background tracking?

Compare: https://github.com/ionic-team/cordova-plugin-ionic-webview#wksuspendinbackground

christocracy commented 5 years ago

That option seems to have been added recently. Try it out and let me know.

Mike1707 commented 5 years ago

I have also an update for my initial issue. After upgrading to iOS 12.0.1, the background tracking seems to work again on iPhone XS. My tests worked all for hours in background mode. With 12.0.0 just for a few seconds.

christocracy commented 5 years ago

When you upgrade iOS, always restart the device after install complete.

Mike1707 commented 5 years ago

That option seems to have been added recently. Try it out and let me know.

I tried the new webview but I had other general issues. After the app suspended (without tracking), my app was not able to reach my backend anymore after waking up again. I never noticed something like that and therefore, I'll not use the webview for now!

christocracy commented 5 years ago

@Mike1707 Are you providing the plugin an #url and letting it handle uploading locations to your server?

dylanvdmerwe commented 5 years ago

The cordova-plugin-ionic-webview plugin is quite important for ionic applications (for both android and iOS apps) as it fixes many issues like scrolling. I would suggest against removing it. Please do log an issue with them so they can get it sorted rather.

Mike1707 commented 5 years ago

@Mike1707 Are you providing the plugin an #url and letting it handle uploading locations to your server?

No, I'm doing this on my own. But none of my requests worked in this case.

@dylanvdmerwe I'm going to log an issue but I need time to debug it first on my own.

christocracy commented 5 years ago

@Mike1707 Why are you posting locations "on your own"? They plugin's native HTTP service is superior at this task.

Mike1707 commented 5 years ago

Maybe I should refactor my code but until now I'm building a GeoJSON LineString Object locally and after finishing the tracking, I send this Object to my backend/database.

The purpose was to minimize the amount of backend requests.

Do you think this is bad practise?

christocracy commented 5 years ago

It seems ionic-webview have solved their issue booting in background as of version 2.0.3 (latest is 2.2.5)

Mike1707 commented 5 years ago

That are great news. Nevertheless, I have other big issues with webview and opened an issue as @dylanvdmerwe proposed (see https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/215)

christocracy commented 5 years ago

Oh, lovely. I have an iPhone 6s still running iOS 11. I’ll compare that with iPhone X @ 12

obkdev commented 5 years ago

What is interesting... I was experiencing the same white screen on resume issue. I've now removed the webview plugin but my app goes white right after the splashscreen.

christocracy commented 5 years ago

Observe your JS web console for errors. Execute >window.location.reload() to observe your app booting.

obkdev commented 5 years ago

Xcode logs are giving me:

2019-03-22 16:48:00.366996+0000 LogIt-In[916:72045] Resetting plugins due to page load. 2019-03-22 16:48:00.491534+0000 LogIt-In[916:72101] NSURLConnection finished with error - code -1100

obkdev commented 5 years ago

If I've reinstalled webview 4.0.0 and now my app loads up again... Should I worry about the white screen on resume later?

christocracy commented 5 years ago

Should I worry about the white screen on resume later?

I don't know. I don't use Webview.

obkdev commented 5 years ago

I will report back when I know the answer for the next people who have the problem :)

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.

stale[bot] commented 4 years ago

Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.