transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.66k stars 426 forks source link

App on IOS crashes while using BackgroundGeolocation.watchPosition #2169

Closed thur-c closed 1 month ago

thur-c commented 1 month ago

App on IOS crashes while using BackgroundGeolocation.watchPosition

Expected Behavior

It shouldn't crash and works when gets current position

Actual Behavior

I notice when I use BackgroundGeolocation.watchPosition the app crashes and closes.

Steps to Reproduce

  1. Start the app without BackgroundGeolocation.watchPosition
  2. Works fine!
  3. Add BackgroundGeolocation.watchPosition and reload the project
  4. App closes

Context

Debug logs

Xcode Logs ``` Thread 1: "Error when sending event: enabledchange with body: 0. RCTCallableJSModules is not set. This is probably because you've explicitly synthesized the RCTCallableJSModules in RNBackgroundGeolocation, even though it's inherited from RCTEventEmitter." ```
Plugin Logs ``` 2024-10-10 10:09:42.452 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:09:42.452 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 13 OF ( 11, 13 ) 2024-10-10 10:09:43.428 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:09:53.430 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:09:53 Brasilia Standard Time 2024-10-10 10:09:53.430 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:09:53.430 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (336 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:09:53.431 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:09:53.431 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:09:53.431 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:09:53.441 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: 182B6C9E-15C4-4D61-A57E-8743D755DF4C 2024-10-10 10:09:53.441 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:09:53.443 ✅-[BackgroundTaskManager createBackgroundTask] 14 2024-10-10 10:09:53.446 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:09:53.449 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask .<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask .<1>", "LocalDataTask <9CA65111-B8CD-4684-AB2C-531D58C738A1>.<20>" ); } 2024-10-10 10:09:53.451 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:09:53.451 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:09:53.451 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 14 OF ( 11, 14 ) 2024-10-10 10:09:54.429 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:10:04.430 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:10:04 Brasilia Standard Time 2024-10-10 10:10:04.430 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:10:04.430 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (329 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:04.431 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:10:04.431 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:10:04.431 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:10:04.441 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: 702CAFB5-54D6-4AB3-A0F1-3125C03C9A06 2024-10-10 10:10:04.442 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:04.444 ✅-[BackgroundTaskManager createBackgroundTask] 15 2024-10-10 10:10:04.446 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:10:04.449 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask <3E4E1F13-454D-43EF-8D86-698340F809BD>.<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask <3E4E1F13-454D-43EF-8D86-698340F809BD>.<1>", "LocalDataTask .<21>" ); } 2024-10-10 10:10:04.451 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:10:04.451 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:04.451 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 15 OF ( 11, 15 ) 2024-10-10 10:10:05.429 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:10:15.430 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:10:11 Brasilia Standard Time 2024-10-10 10:10:15.430 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:10:15.430 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (3937 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:15.431 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:10:15.431 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:10:15.431 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:10:15.441 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: 42422549-6F87-4AC9-9F67-EDF24172EB39 2024-10-10 10:10:15.441 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:15.444 ✅-[BackgroundTaskManager createBackgroundTask] 16 2024-10-10 10:10:15.446 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:10:15.449 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask <3A20ADA6-B886-4039-AB8F-1A5B39A18C1B>.<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask <3A20ADA6-B886-4039-AB8F-1A5B39A18C1B>.<1>", "LocalDataTask <345DEF88-6E59-4ADC-BEF3-804E936BE33D>.<22>" ); } 2024-10-10 10:10:15.451 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:10:15.451 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:15.451 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 16 OF ( 11, 16 ) 2024-10-10 10:10:16.429 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:10:22.426 ℹ️-[TSDBLogger db_save] Log committed 2024-10-10 10:10:26.430 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:10:23 Brasilia Standard Time 2024-10-10 10:10:26.430 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:10:26.430 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (3330 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:26.431 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:10:26.431 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:10:26.431 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:10:26.441 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: 8E113DA7-BA0A-4CD2-9547-625A24554F7C 2024-10-10 10:10:26.441 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:26.444 ✅-[BackgroundTaskManager createBackgroundTask] 17 2024-10-10 10:10:26.447 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:10:26.450 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask .<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask .<1>", "LocalDataTask <8093ED97-9F69-4F53-A766-83774878F767>.<23>" ); } 2024-10-10 10:10:26.452 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:10:26.452 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:26.452 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 17 OF ( 11, 17 ) 2024-10-10 10:10:27.429 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:10:37.430 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:10:35 Brasilia Standard Time 2024-10-10 10:10:37.430 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:10:37.430 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (2330 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:37.431 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:10:37.431 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:10:37.431 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:10:37.441 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: E43E9C63-B852-4165-9714-5DBAA06200C5 2024-10-10 10:10:37.441 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:37.443 ✅-[BackgroundTaskManager createBackgroundTask] 18 2024-10-10 10:10:37.446 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:10:37.449 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask <30347807-CB53-4733-ADE8-DD2DB2DF329D>.<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask <30347807-CB53-4733-ADE8-DD2DB2DF329D>.<1>", "LocalDataTask .<24>" ); } 2024-10-10 10:10:37.451 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:10:37.451 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:37.451 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 18 OF ( 11, 18 ) 2024-10-10 10:10:38.428 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:10:48.429 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:10:41 Brasilia Standard Time 2024-10-10 10:10:48.429 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:10:48.430 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (6929 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:48.431 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:10:48.431 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:10:48.431 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:10:48.441 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: 0D5E1E66-2457-41F4-A27D-C546D0645CFF 2024-10-10 10:10:48.441 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:48.444 ✅-[BackgroundTaskManager createBackgroundTask] 19 2024-10-10 10:10:48.446 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:10:48.449 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask <0A89BF04-24F9-4634-B119-6FEE59E2B658>.<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask <0A89BF04-24F9-4634-B119-6FEE59E2B658>.<1>", "LocalDataTask <50C86111-BD3B-43D8-8FF6-97642D2BA92B>.<25>" ); } 2024-10-10 10:10:48.452 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:10:48.452 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:48.452 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 19 OF ( 11, 19 ) 2024-10-10 10:10:49.428 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:10:59.429 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:10:56 Brasilia Standard Time 2024-10-10 10:10:59.429 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:10:59.430 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (2925 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:59.430 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:10:59.431 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:10:59.431 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:10:59.441 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: C99FC875-2021-40A5-A5B2-C6DFA99C920E 2024-10-10 10:10:59.441 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:59.443 ✅-[BackgroundTaskManager createBackgroundTask] 20 2024-10-10 10:10:59.445 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:10:59.448 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask .<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask .<1>", "LocalDataTask <1DD4A201-C295-467E-8B45-F1412B176961>.<26>" ); } 2024-10-10 10:10:59.450 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:10:59.450 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:10:59.450 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 20 OF ( 11, 20 ) 2024-10-10 10:11:00.428 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:11:10.429 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:11:05 Brasilia Standard Time 2024-10-10 10:11:10.429 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:11:10.429 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (5331 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:10.430 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:11:10.430 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:11:10.430 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:11:10.440 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: 9A01F7ED-A2D1-4F7C-9033-85BCF2C009AC 2024-10-10 10:11:10.440 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:10.443 ✅-[BackgroundTaskManager createBackgroundTask] 21 2024-10-10 10:11:10.445 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:11:10.448 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask <31DD276E-B078-4153-B17B-2A7FE7270C82>.<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask <31DD276E-B078-4153-B17B-2A7FE7270C82>.<1>", "LocalDataTask <15263F33-F547-4D17-BC92-D3196D23D7B6>.<27>" ); } 2024-10-10 10:11:10.450 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:11:10.450 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:10.450 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 21 OF ( 11, 21 ) 2024-10-10 10:11:11.428 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:11:21.429 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:11:11 Brasilia Standard Time 2024-10-10 10:11:21.429 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:11:21.429 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (9920 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:21.430 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:11:21.430 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:11:21.430 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:11:21.440 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: F2335050-F104-46B3-812F-92FFFD13B0EC 2024-10-10 10:11:21.440 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:21.442 ✅-[BackgroundTaskManager createBackgroundTask] 22 2024-10-10 10:11:21.445 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:11:21.447 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask <0273E9A2-54BC-4C5D-89C1-7BC281AF0CAB>.<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask <0273E9A2-54BC-4C5D-89C1-7BC281AF0CAB>.<1>", "LocalDataTask <3D53DB5D-DDF2-431A-919B-C53DABCC4B67>.<28>" ); } 2024-10-10 10:11:21.449 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:11:21.450 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:21.450 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 22 OF ( 11, 22 ) 2024-10-10 10:11:22.427 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:11:23.344 ℹ️-[TSDBLogger db_save] Log committed 2024-10-10 10:11:32.428 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:11:26 Brasilia Standard Time 2024-10-10 10:11:32.428 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:11:32.429 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (5915 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:32.430 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:11:32.430 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:11:32.430 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:11:32.440 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: D66C0537-0A30-4497-AFCD-7756F6964B4E 2024-10-10 10:11:32.440 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:32.442 ✅-[BackgroundTaskManager createBackgroundTask] 23 2024-10-10 10:11:32.445 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:11:32.448 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask .<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask .<1>", "LocalDataTask <1FB7D6A3-7AE4-4948-8A67-370965F574EB>.<29>" ); } 2024-10-10 10:11:32.450 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:11:32.450 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:32.450 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 23 OF ( 11, 23 ) 2024-10-10 10:11:33.427 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:11:43.428 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:11:41 Brasilia Standard Time 2024-10-10 10:11:43.428 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:11:43.429 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (1909 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:43.429 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:11:43.430 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:11:43.430 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:11:43.439 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: 4F62B9C9-022E-4E99-A189-C6BFB34D4F4F 2024-10-10 10:11:43.440 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:43.442 ✅-[BackgroundTaskManager createBackgroundTask] 24 2024-10-10 10:11:43.444 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:11:43.447 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask <2C2260FC-6440-4EA2-8039-35D4431FFE0B>.<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask <2C2260FC-6440-4EA2-8039-35D4431FFE0B>.<1>", "LocalDataTask <04E76615-E607-452D-A08D-8339B1122D7B>.<30>" ); } 2024-10-10 10:11:43.449 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:11:43.449 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:43.449 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 24 OF ( 11, 24 ) 2024-10-10 10:11:44.427 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:11:54.428 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:11:53 Brasilia Standard Time 2024-10-10 10:11:54.428 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:11:54.428 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (1331 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:54.429 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:11:54.429 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:11:54.429 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:11:54.439 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: 32652315-F80F-4110-AFC7-61FD6B57C445 2024-10-10 10:11:54.439 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:54.441 ✅-[BackgroundTaskManager createBackgroundTask] 25 2024-10-10 10:11:54.444 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:11:54.447 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask <47D62280-4BE6-4669-B8CD-EC5A91888372>.<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask <47D62280-4BE6-4669-B8CD-EC5A91888372>.<1>", "LocalDataTask .<31>" ); } 2024-10-10 10:11:54.449 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:11:54.449 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:11:54.449 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 25 OF ( 11, 25 ) 2024-10-10 10:11:55.427 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:12:05.428 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:12:05 Brasilia Standard Time 2024-10-10 10:12:05.428 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:12:05.428 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (331 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:12:05.429 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:12:05.429 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:12:05.429 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:12:05.439 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: D6510C89-4D88-4F3E-BF04-DA57C527A5F5 2024-10-10 10:12:05.439 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:12:05.442 ✅-[BackgroundTaskManager createBackgroundTask] 26 2024-10-10 10:12:05.445 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:12:05.447 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask <6E851F58-975B-413B-B55A-A49311DBD265>.<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask <6E851F58-975B-413B-B55A-A49311DBD265>.<1>", "LocalDataTask <7434EA63-D7BF-4645-B546-EC073B27C995>.<33>" ); } 2024-10-10 10:12:05.449 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:12:05.450 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:12:05.450 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 26 OF ( 11, 26 ) 2024-10-10 10:12:06.426 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:12:16.427 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:12:11 Brasilia Standard Time 2024-10-10 10:12:16.427 🔴-[LocationManager stopUpdatingLocation] OFF 2024-10-10 10:12:16.428 ╔═══════════════════════════════════════════════════════════ ║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 1 (4901 ms old) ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:12:16.429 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:12:16.429 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0 2024-10-10 10:12:16.429 ℹ️-[PolygonGeofencingService setLocation:] Already updating location 2024-10-10 10:12:16.439 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: FDAA6C3C-B59A-4D9B-9BE4-F850F5AE9DF6 2024-10-10 10:12:16.439 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:12:16.441 ✅-[BackgroundTaskManager createBackgroundTask] 27 2024-10-10 10:12:16.443 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:12:16.446 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask <4B6667A3-C17C-4142-9A15-97515B892295>.<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask <4B6667A3-C17C-4142-9A15-97515B892295>.<1>", "LocalDataTask .<34>" ); } 2024-10-10 10:12:16.448 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:12:16.448 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:12:16.448 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 27 OF ( 11, 27 ) 2024-10-10 10:12:17.426 🎾-[LocationManager onWatchPositionTimer:] ONESHOT 2024-10-10 10:12:20.180 ℹ️-[TSLocationManager log:message:] [RNBackgroundGeolocation stopObserving] 2024-10-10 10:12:33.719 ℹ️-[TSDBLogger db_delete] maxAge: 259200 2024-10-10 10:12:33.720 ℹ️-[TSLocationManager init] ╔═════════════════════════════════════════════ ║ TSLocationManager (build 388) ╠══════════════════════════════════════════════ { activityRecognitionInterval = 10000; activityType = 1; authorization = { }; autoSync = 1; autoSyncThreshold = 0; batchSync = 0; debug = 0; desiredAccuracy = "-1"; desiredOdometerAccuracy = 100; didDeviceReboot = 0; didLaunchInBackground = 0; didRequestUpgradeLocationAuthorization = 1; disableAutoSyncOnCellular = 0; disableElasticity = 1; disableLocationAuthorizationAlert = 0; disableMotionActivityUpdates = 1; disableStopDetection = 0; distanceFilter = 0; elasticityMultiplier = 1; enableTimestampMeta = 0; enabled = 1; extras = { }; geofenceInitialTriggerEntry = 1; geofenceProximityRadius = 2000; geofenceTemplate = ""; headers = { "my-auth-token" = "secret-key"; }; heartbeatInterval = 60; httpRootProperty = location; httpTimeout = 60000; iOSHasWarnedLocationServicesOff = 1; isFirstBoot = 0; isMoving = 0; lastLocationAuthorizationStatus = 3; locationAuthorizationAlert = { cancelButton = Cancel; instructions = "To use background location, you must enable '{locationAuthorizationRequest}' in the Location Services settings"; settingsButton = Settings; titleWhenNotEnabled = "Background location is not enabled"; titleWhenOff = "Location services are off"; }; locationAuthorizationRequest = Always; locationTemplate = ""; locationTimeout = 60; locationsOrderDirection = ASC; logLevel = 5; logMaxDays = 3; maxBatchSize = "-1"; maxDaysToPersist = 1; maxRecordsToPersist = "-1"; method = POST; minimumActivityRecognitionConfidence = 70; odometer = 0; params = { "user_id" = 123; }; pausesLocationUpdatesAutomatically = 1; persistMode = 2; preventSuspend = 0; schedule = ( ); schedulerEnabled = 0; showsBackgroundLocationIndicator = 1; startOnBoot = 1; stationaryRadius = 25; stopAfterElapsedMinutes = "-1"; stopDetectionDelay = 0; stopOnStationary = 0; stopOnTerminate = 0; stopTimeout = 1; trackingMode = 1; url = "http://my.server.com"; useSignificantChangesOnly = 0; } 2024-10-10 10:12:33.722 ℹ️-[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 D OUBLE 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, vertices TEXT) 2024-10-10 10:12:33.722 ℹ️-[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 (long itude);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); 2024-10-10 10:12:33.725 🔵-[TSLocationManager locationManager:didChangeAuthorizationStatus:] status 3 2024-10-10 10:12:33.730 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 3 2024-10-10 10:12:33.730 🔵-[PolygonGeofencingService locationManager:didChangeAuthorizationStatus:] 3 2024-10-10 10:12:33.734 ℹ️+[LocationAuthorization run:onCancel:] status: 3 2024-10-10 10:12:33.734 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 3 2024-10-10 10:12:33.734 🔵-[BackgroundTaskManager locationManager:didChangeAuthorizationStatus:] 3 2024-10-10 10:12:33.734 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 3 2024-10-10 10:12:34.697 ℹ️-[TSLocationManager on:success:failure:] location 2024-10-10 10:12:34.697 ℹ️-[TSLocationManager on:success:failure:] motionchange 2024-10-10 10:12:34.697 ℹ️-[TSLocationManager on:success:failure:] activitychange 2024-10-10 10:12:34.697 ℹ️-[TSLocationManager on:success:failure:] heartbeat 2024-10-10 10:12:34.697 ℹ️-[TSGeofenceManager onGeofence:] 2024-10-10 10:12:34.697 ℹ️-[TSGeofenceManager onGeofencesChange:] 2024-10-10 10:12:34.697 ℹ️-[TSLocationManager on:success:failure:] http 2024-10-10 10:12:34.697 ℹ️-[TSLocationManager on:success:failure:] providerchange 2024-10-10 10:12:34.697 ℹ️-[TSLocationManager on:success:failure:] schedule 2024-10-10 10:12:34.697 ℹ️-[TSLocationManager on:success:failure:] powersavechange 2024-10-10 10:12:34.697 ℹ️-[TSHttpService onConnectivityChange:] 2024-10-10 10:12:34.697 ℹ️-[TSLocationManager on:success:failure:] enabledchange 2024-10-10 10:12:34.697 ℹ️-[TSHttpService onAuthorization:] 2024-10-10 10:12:34.699 ℹ️-[TSConfig persist] 2024-10-10 10:12:34.700 ℹ️-[TSConfig persist] 2024-10-10 10:12:34.701 🔵-[TSLocationManager ready] 2024-10-10 10:12:34.702 ℹ️-[TSLocationManager doStart:] trackingMode: 1 2024-10-10 10:12:34.702 ℹ️-[TSLocationManager loadLastOdometerLocation] <-23.47537242,-47.42686657> +/- -1.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:12:34 Brasilia Standard Time 2024-10-10 10:12:34.702 🎾-[TSGeofenceManager start] 2024-10-10 10:12:34.703 🔵-[TSLocationManager setPace:] 0 2024-10-10 10:12:34.704 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON 2024-10-10 10:12:34.704 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:12:34.704 ✅-[LocationDAO unlock]_block_invoke UNLOCKED ALL RECORDS 2024-10-10 10:12:34.706 ✅-[BackgroundTaskManager createBackgroundTask] 3 2024-10-10 10:12:34.706 ╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager stop] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:12:34.706 ℹ️-[TSConfig persist] 2024-10-10 10:12:34.709 ✅-[TSHttpService schedulePost] LOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:12:34.711 ⚠️-[HttpResponse handleResponse] HTTP ERROR: 0 *** * The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. * { NSErrorFailingURLKey = "http://my.server.com/"; NSErrorFailingURLStringKey = "http://my.server.com/"; NSLocalizedDescription = "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."; NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null)\""; "_NSURLErrorFailingURLSessionTaskErrorKey" = "LocalDataTask <80FA0B97-7D3A-4337-B6DF-3F3D6FDFA6B5>.<1>"; "_NSURLErrorRelatedURLSessionTaskErrorKey" = ( "LocalDataTask <80FA0B97-7D3A-4337-B6DF-3F3D6FDFA6B5>.<1>", "LocalDataTask <918FE24B-7491-44D5-84B8-CA07AFE735A5>.<2>" ); } 2024-10-10 10:12:34.712 ✅-[TSHttpService post:]_block_invoke UNLOCKED: F8302039-B9BE-415D-AD6D-29049786D359 2024-10-10 10:12:34.712 ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 0 ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:12:34.713 ℹ️+[LocationAuthorization run:onCancel:] status: 3 2024-10-10 10:12:34.713 🎾-[TSLocationManager startMonitoringBackgroundFetch] BackgroundFetch: ON 2024-10-10 10:12:34.714 📍<-23.47537242,-47.42686657> +/- 35.00m (speed -1.00 mps / course -1.00) @ 10/10/24, 10:12:26 Brasilia Standard Time 2024-10-10 10:12:34.714 ╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 0 | isMoving: 0 | df: -1.0m | age: 8182 ms ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:12:34.714 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 3 OF ( 3 ) 2024-10-10 10:12:34.716 ℹ️-[TSLocationManager clearLastOdometerLocation] 2024-10-10 10:12:34.716 🔴-[TSGeofenceManager stop] 2024-10-10 10:12:34.716 🔴-[TSGeofenceManager stopMonitoringSignificantLocationChanges] 2024-10-10 10:12:34.716 🔴-[TSGeofenceManager stopUpdatingLocation] 2024-10-10 10:12:34.716 🔴-[TSGeofenceManager stopMonitoringGeofences] 2024-10-10 10:12:34.717 ℹ️-[TSLocationManager startMonitoringBackgroundFetch]_block_invoke Configured BackgroundFetch 2024-10-10 10:12:34.722 🔴-[PolygonGeofencingService stop] 2024-10-10 10:12:34.722 ℹ️-[PolygonGeofencingService persistMonitoredPolygons] { } 2024-10-10 10:12:34.722 🔴-[TSLocationManager stopUpdatingLocation] 2024-10-10 10:12:34.722 🔴-[TSLocationManager stopMonitoringBackgroundFetch] BackgroundFetch: OFF 2024-10-10 10:12:34.724 🔴-[TSLocationManager stopMonitoringSignificantLocationChanges] 2024-10-10 10:12:34.725 🔴-[TSGeofenceManager stopUpdatingLocation] 2024-10-10 10:12:34.735 ╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager start] ╚═══════════════════════════════════════════════════════════ 2024-10-10 10:12:34.735 ℹ️-[TSLocationManager doStart:] trackingMode: 1 2024-10-10 10:12:34.735 ℹ️-[TSConfig persist] 2024-10-10 10:12:34.735 🎾-[TSGeofenceManager start] 2024-10-10 10:12:34.735 🎾-[LocationManager watchPosition:] START 2024-10-10 10:12:34.735 🔵-[TSLocationManager setPace:] 0 2024-10-10 10:12:34.740 ✅-[BackgroundTaskManager createBackgroundTask] 4 ```
christocracy commented 1 month ago

Post your code.

why are you using .watchPosition? It’s generally not required.

thur-c commented 1 month ago

I am using watchPosition because I'm developing an app that fetches the user location while it's on the background. It's just a test I'm making. WatchPosition works well with expo or it's better to use in in pure react native? It works well with Android but on IOS it crashes. Is expo the problem or am I missing something here?

` const [currentLocation, setCurrentLocation] = useState(); const [enabled, setEnabled] = useState(false);

function configBackgroundGeolocation() {
    BackgroundGeolocation.ready({
        desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
        distanceFilter: 0,
        stopTimeout: 1,
        debug: false,
        logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
        disableMotionActivityUpdates: true,
        stopOnTerminate: false,
        startOnBoot: true,
        locationUpdateInterval: 1000,
        fastestLocationUpdateInterval: 1000,
        useSignificantChangesOnly: false,
        disableElasticity: true,
        url: 'http://my.server.com',
        params: {
            user_id: 123,
        },
        headers: {
            'my-auth-token': 'secret-key',
        },
    }).then(() => {
        setEnabled(true);
        console.log('- BackgroundGeolocation is configured and ready: ', enabled);
    });
}

useEffect(() => {
    try {
        configBackgroundGeolocation();
    } catch (error) {
        console.error(error.message);
    } finally {
        console.log('Finished processing background geolocation');
    }
}, []);

async function logs(){
    const Logger = BackgroundGeolocation.logger;
    const log = await Logger.getLog();
    console.log(log);
}

useEffect(() => {
    try {
        if (enabled) {
            BackgroundGeolocation.start();
            // Watch position updates
            BackgroundGeolocation.watchPosition(
                (location) => {
                    // console.log('[watchPosition] -', location.coords.speed);
                    setCurrentLocation(location);
                },
                (errorCode) => {
                    console.log('[watchPosition] ERROR -', errorCode);
                },
                {
                    interval: 1000,
                    desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
                    persist: true,
                    timeout: 60000,
                }
            );

            // Listener for location updates
            BackgroundGeolocation.on('location', (location: Location) => {
                setCurrentLocation(location);
            });

            logs();

        } else {
            BackgroundGeolocation.stop();
        }
    } catch (error) {
        console.log(error);
    }
}, [enabled]);
`
christocracy commented 1 month ago

.watchPosition should be avoided. It’s designed for use only for short periods of time in the foreground. You probably don’t need it.

With debug: true, after calling .start(), go outside for a ~1km walk. That’s all you need to do. The plug-in will automatically begin tracking after the device is detected to be moving (requires movement of ~200 meters.)

see wiki here “Philosophy of Operation”.

thur-c commented 1 month ago

Thanks a lot! It's work for me, I'm closing now!