react-native-background-geolocation
react-native-background-geolocation copied to clipboard
iOS location request hides motion & fitness request
Your Environment
- Plugin version: 4.16.2
- Platform: iOS
- OS version: 17.5.1
- Device manufacturer / model: Apple iPad Pro (also seen on iPhone)
- React Native version (
react-native -v): 0.74.1 (Expo 51.0.9) - Plugin config
{
"activityRecognitionInterval": 10000,
"allowIdenticalLocations": false,
"authorization": {},
"autoSync": true,
"autoSyncThreshold": 0,
"backgroundPermissionRationale": {
"title": "Allow access to this device's location in the background?",
"message": "In order to log your commuting activity automatically, please enable 'Allow all the time permission",
"positiveAction": "Change to Allow all the time",
"negativeAction": ""
},
"batchSync": false,
"configUrl": "",
"debug": false,
"deferTime": 0,
"desiredAccuracy": -1,
"desiredOdometerAccuracy": 100,
"disableAutoSyncOnCellular": false,
"disableElasticity": false,
"disableLocationAuthorizationAlert": false,
"disableMotionActivityUpdates": false,
"disableProviderChangeRecord": false,
"disableStopDetection": false,
"distanceFilter": 10,
"elasticityMultiplier": 1,
"enableHeadless": true,
"enableTimestampMeta": false,
"extras": {
"org": "mobilityways"
},
"fastestLocationUpdateInterval": -1,
"foregroundService": true,
"geofenceInitialTriggerEntry": true,
"geofenceModeHighAccuracy": false,
"geofenceProximityRadius": 1000,
"geofenceTemplate": "",
"headers": {
"authorization": "Bearer xx"
},
"headlessJobService": "com.transistorsoft.rnbackgroundgeolocation.HeadlessTask",
"heartbeatInterval": -1,
"httpRootProperty": "location",
"httpTimeout": 60000,
"isMoving": false,
"locationAuthorizationRequest": "Always",
"locationTemplate": "",
"locationTimeout": 60,
"locationUpdateInterval": 1000,
"locationsOrderDirection": "ASC",
"logLevel": 5,
"logMaxDays": 3,
"maxBatchSize": -1,
"maxDaysToPersist": 1,
"maxMonitoredGeofences": 97,
"maxRecordsToPersist": -1,
"method": "POST",
"minimumActivityRecognitionConfidence": 75,
"motionTriggerDelay": 0,
"notification": {
"layout": "",
"title": "Mobilityways POC tracking",
"text": "Location tracking on",
"color": "",
"channelName": "TSLocationManager",
"channelId": "",
"smallIcon": "",
"largeIcon": "",
"priority": -1,
"sticky": false,
"strings": {},
"actions": []
},
"params": {},
"persist": true,
"persistMode": 2,
"schedule": [],
"scheduleUseAlarmManager": false,
"speedJumpFilter": 300,
"startOnBoot": true,
"stationaryRadius": 25,
"stopAfterElapsedMinutes": 0,
"stopOnStationary": false,
"stopOnTerminate": false,
"stopTimeout": 5,
"triggerActivities": "in_vehicle, on_bicycle, on_foot, running, walking",
"url": "https:\/\/[interface.liftshare.com](http://interface.liftshare.com/)\/v2\/liftshare\/location-data",
"useSignificantChangesOnly": false,
"enabled": false,
"schedulerEnabled": false,
"trackingMode": 1,
"odometer": 3354.201416015625,
"isFirstBoot": false,
"didLaunchInBackground": false,
"didDeviceReboot": false
}
╔═════════════════════════════════════════════
║ DEVICE SENSORS
╠═════════════════════════════════════════════
╟─ ✅ ACCELEROMETER: {Sensor name="ICM45631 Accelerometer", vendor="Invensense", version=1, type=1, maxRange=156.9064, resolution=5.985504E-4, power=0.001, minDelay=5000}
╟─ ✅ GYROSCOPE: {Sensor name="ICM45631 Gyroscope", vendor="Invensense", version=1, type=4, maxRange=34.906586, resolution=1.3323124E-4, power=0.001, minDelay=5000}
╟─ ✅ MAGNETOMETER: {Sensor name="MMC56X3X Magnetometer", vendor="MEMSIC", version=1, type=2, maxRange=3198.1567, resolution=0.0976, power=0.001, minDelay=10000}
╟─ ✅ SIGNIFICANT_MOTION: {Sensor name="Significant Motion (wake-up)", vendor="Google", version=1, type=17, maxRange=1.0, resolution=1.0, power=0.001, minDelay=-1}
╚═════════════════════════════════════════════
Expected Behavior
Permission requests should appear in sequence
Actual Behavior
The "...would like to access your Motion & Fitness Activity" request appears then is immediately overlaid by the "Allow ... to use your location" request, before the user has chance to accept or decline. See video here:
https://photos.app.goo.gl/5C7HkWVjQW4DQ8498
Steps to Reproduce
BackgroundGeolocation.start();with no permissions granted- Observe system dialogs as above
Context
Request necessary permissions from the user for this plugin to work on iOS. (everything seems fine on Android with same code)
Debug logs
Logs
2024-06-05 16:37:15.852
╔═══════════════════════════════════════════════════════════
║ -[TSLocationManager start]
╚═══════════════════════════════════════════════════════════
2024-06-05 16:37:15.852 ℹ️-[TSLocationManager doStart:] trackingMode: 1
2024-06-05 16:37:15.852 ℹ️-[TSConfig persist]
2024-06-05 16:37:15.855 🎾-[TSGeofenceManager start]
2024-06-05 16:37:15.856 🎾-[SOMotionDetector startDetection]
2024-06-05 16:37:15.857 🔵-[TSLocationManager setPace:] 0
2024-06-05 16:37:15.859 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON
2024-06-05 16:37:15.860
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService flush:]
╚═══════════════════════════════════════════════════════════
2024-06-05 16:37:15.862 ✅-[LocationDAO unlock]_block_invoke UNLOCKED ALL RECORDS
2024-06-05 16:37:15.862
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService finish:error:] Success: 1
╚═══════════════════════════════════════════════════════════
2024-06-05 16:37:15.865 ℹ️+[LocationAuthorization run:onCancel:] status: 0
2024-06-05 16:37:15.865 🔵+[LocationAuthorization run:onCancel:] Request: requestAlwaysAuthorization
2024-06-05 16:37:15.865 🎾-[TSLocationManager startMonitoringBackgroundFetch] BackgroundFetch: ON
2024-06-05 16:37:15.868 ℹ️-[TSLocationManager startMonitoringBackgroundFetch]_block_invoke Configured BackgroundFetch
2024-06-05 16:37:17.869 ⚠️-[TSLocationManager locationManager:didFailWithError:] Error Domain=kCLErrorDomain Code=1 "(null)"
2024-06-05 16:37:18.478 ℹ️-[TSConfig persist]
2024-06-05 16:37:18.483 🔵-[TSLocationManager locationManager:didChangeAuthorizationStatus:] status 4
2024-06-05 16:37:18.501 🔵-[BackgroundTaskManager locationManager:didChangeAuthorizationStatus:] 4
2024-06-05 16:37:18.501 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 4
2024-06-05 16:37:18.501 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 4
2024-06-05 16:37:18.501 🔵-[PolygonGeofencingService locationManager:didChangeAuthorizationStatus:] 4
2024-06-05 16:37:18.501 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 4
2024-06-05 16:37:18.503
📍<+53.45098882,-2.26261925> +/- 35.00m (speed -1.00 mps / course -1.00) @ 05/06/2024, 16:37:16 British Summer Time
2024-06-05 16:37:18.503
╔═══════════════════════════════════════════════════════════
║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 1980 ms
╚═══════════════════════════════════════════════════════════
2024-06-05 16:37:18.503 ✅-[TSLocationManager locationManager:didUpdateLocations:] Acquired motionchange position: <+53.45098882,-2.26261925> +/- 35.00m (speed -1.00 mps / course -1.00) @ 05/06/2024, 16:37:16 British Summer Time
2024-06-05 16:37:18.506 🔵-[TSLocationManager startMonitoringStationaryRegion:radius:] Radius: 200
2024-06-05 16:37:18.508 🔴-[TSLocationManager stopUpdatingLocation]
2024-06-05 16:37:18.509 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0
2024-06-05 16:37:18.509 ℹ️-[PolygonGeofencingService setLocation:] Already updating location <IGNORED>
2024-06-05 16:37:18.510 🎾-[TSLocationManager startMonitoringSignificantLocationChanges]
2024-06-05 16:37:18.510 ℹ️-[PolygonGeofencingService setLocation:] Already updating location <IGNORED>
2024-06-05 16:37:18.512 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: B10E4DED-3A6B-4B9D-9591-5DDC6FFEA172
2024-06-05 16:37:18.514 ℹ️+[LocationAuthorization run:onCancel:] status: 4
2024-06-05 16:37:18.514 ℹ️-[TSConfig persist]
2024-06-05 16:37:18.516 ℹ️+[LocationAuthorization run:onCancel:] Location authorization upgrade: WhenInUse -> Always
2024-06-05 16:37:18.517 🔵+[LocationAuthorization run:onCancel:] Request: requestAlwaysAuthorization
2024-06-05 16:37:18.517
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService flush:]
╚═══════════════════════════════════════════════════════════
2024-06-05 16:37:18.581 ✅-[BackgroundTaskManager createBackgroundTask] 79
2024-06-05 16:37:18.583 ✅-[TSHttpService schedulePost] LOCKED: B10E4DED-3A6B-4B9D-9591-5DDC6FFEA172
2024-06-05 16:37:18.755 🔵-[HttpResponse handleResponse] Response: 200
2024-06-05 16:37:18.757 ✅-[TSHttpService post:]_block_invoke DESTROY: B10E4DED-3A6B-4B9D-9591-5DDC6FFEA172
2024-06-05 16:37:18.757
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService finish:error:] Success: 1
╚═══════════════════════════════════════════════════════════
2024-06-05 16:37:18.757 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 79 OF (
79
)
2024-06-05 16:37:21.526 ℹ️-[TSConfig persist]
2024-06-05 16:37:21.534 🔵-[TSLocationManager locationManager:didChangeAuthorizationStatus:] status 3
2024-06-05 16:37:21.544 🔵-[TSLocationManager setPace:] 0
2024-06-05 16:37:21.550 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON
2024-06-05 16:37:21.570 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON
2024-06-05 16:37:21.571 🔵-[BackgroundTaskManager locationManager:didChangeAuthorizationStatus:] 3
2024-06-05 16:37:21.571 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 3
2024-06-05 16:37:21.571 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 3
2024-06-05 16:37:21.571 🔵-[PolygonGeofencingService locationManager:didChangeAuthorizationStatus:] 3
2024-06-05 16:37:21.571 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 3
2024-06-05 16:37:21.571
📍<+53.45101682,-2.26260102> +/- 35.00m (speed -1.00 mps / course -1.00) @ 05/06/2024, 16:37:18 British Summer Time
2024-06-05 16:37:21.571
╔═══════════════════════════════════════════════════════════
║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 2628 ms
╚═══════════════════════════════════════════════════════════
2024-06-05 16:37:21.571 ✅-[TSLocationManager locationManager:didUpdateLocations:] Acquired motionchange position: <+53.45101682,-2.26260102> +/- 35.00m (speed -1.00 mps / course -1.00) @ 05/06/2024, 16:37:18 British Summer Time
2024-06-05 16:37:21.572 🔵-[TSLocationManager startMonitoringStationaryRegion:radius:] Radius: 200
2024-06-05 16:37:21.572 🔴-[TSLocationManager stopUpdatingLocation]
2024-06-05 16:37:21.572 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 35.0
2024-06-05 16:37:21.572 ℹ️-[PolygonGeofencingService setLocation:] Already updating location <IGNORED>
2024-06-05 16:37:21.574 ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: 4C524E08-74A8-4FA3-AFB3-D5F4A6937D36
2024-06-05 16:37:21.591 ℹ️+[LocationAuthorization run:onCancel:] status: 3
2024-06-05 16:37:21.605 ℹ️+[LocationAuthorization run:onCancel:] status: 3
2024-06-05 16:37:21.606
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService flush:]
╚═══════════════════════════════════════════════════════════
2024-06-05 16:37:21.609 ✅-[BackgroundTaskManager createBackgroundTask] 112
2024-06-05 16:37:21.611 ✅-[TSHttpService schedulePost] LOCKED: 4C524E08-74A8-4FA3-AFB3-D5F4A6937D36
2024-06-05 16:37:22.605 🔵-[HttpResponse handleResponse] Response: 200
2024-06-05 16:37:22.613 ✅-[TSHttpService post:]_block_invoke DESTROY: 4C524E08-74A8-4FA3-AFB3-D5F4A6937D36
2024-06-05 16:37:22.613
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService finish:error:] Success: 1
╚═══════════════════════════════════════════════════════════
2024-06-05 16:37:22.613 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 112 OF (
112
)
2024-06-05 16:37:24.104 ✅-[SOMotionDetector startDetection]_block_invoke Enabled M7 MotionActivity updates
2024-06-05 16:37:24.106
╔═══════════════════════════════════════════════════════════
║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/100 | isMoving: 0
╚═══════════════════════════════════════════════════════════