Closed Kiran0791 closed 4 years ago
iOS can and will terminate your app in the background while the device is sitting stationary. That's not unusual. When the device moves about 200 meters, iOS will re-launch your app in the background and tracking resumes. Test with debug: true
and provide logs. See Wiki "Debugging".
On debug it was behaving as expected. On release build we are facing this issue
debug: true
can be used with release builds.
Below is the log on android
--------- beginning of system
--------- beginning of main
--------- beginning of crash
10-24 12:11:17.188 19578 19647 I TSLocationManager: [c.t.l.adapter.TSConfig print]
10-24 12:11:17.188 19578 19647 I TSLocationManager: ╔═════════════════════════════════════════════
10-24 12:11:17.188 19578 19647 I TSLocationManager: ║ TSLocationManager version: 3.0.37 (337)
10-24 12:11:17.188 19578 19647 I TSLocationManager: ╠═════════════════════════════════════════════
10-24 12:11:17.188 19578 19647 I TSLocationManager: {
10-24 12:11:17.188 19578 19647 I TSLocationManager: "activityRecognitionInterval": 10000,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "allowIdenticalLocations": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "autoSync": true,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "autoSyncThreshold": 0,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "batchSync": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "configUrl": "",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "debug": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "deferTime": 0,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "desiredAccuracy": -1,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "desiredOdometerAccuracy": 100,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "disableElasticity": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "disableLocationAuthorizationAlert": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "disableMotionActivityUpdates": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "disableStopDetection": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "distanceFilter": 100,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "elasticityMultiplier": 1,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "enableHeadless": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "enableTimestampMeta": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "extras": {},
10-24 12:11:17.188 19578 19647 I TSLocationManager: "fastestLocationUpdateInterval": -1,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "forceReloadOnBoot": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "forceReloadOnGeofence": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "forceReloadOnHeartbeat": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "forceReloadOnLocationChange": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "forceReloadOnMotionChange": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "forceReloadOnSchedule": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "foregroundService": true,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "geofenceInitialTriggerEntry": true,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "geofenceModeHighAccuracy": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "geofenceProximityRadius": 1000,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "geofenceTemplate": "",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "headers": {},
10-24 12:11:17.188 19578 19647 I TSLocationManager: "headlessJobService": "com.transistorsoft.rnbackgroundgeolocation.HeadlessTask",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "heartbeatInterval": -1,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "httpRootProperty": "location",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "httpTimeout": 60000,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "isMoving": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "locationAuthorizationRequest": "Always",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "locationTemplate": "",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "locationTimeout": 60,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "locationUpdateInterval": 1000,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "locationsOrderDirection": "ASC",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "logLevel": 5,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "logMaxDays": 3,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "maxBatchSize": -1,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "maxDaysToPersist": 1,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "maxRecordsToPersist": -1,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "method": "POST",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "minimumActivityRecognitionConfidence": 75,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "notification": {
10-24 12:11:17.188 19578 19647 I TSLocationManager: "layout": "",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "title": "",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "text": "Location Service activated",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "color": "",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "channelName": "TSLocationManager",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "smallIcon": "",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "largeIcon": "",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "priority": 0,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "strings": {},
10-24 12:11:17.188 19578 19647 I TSLocationManager: "actions": []
10-24 12:11:17.188 19578 19647 I TSLocationManager: },
10-24 12:11:17.188 19578 19647 I TSLocationManager: "params": {},
10-24 12:11:17.188 19578 19647 I TSLocationManager: "persist": true,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "persistMode": 2,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "schedule": [],
10-24 12:11:17.188 19578 19647 I TSLocationManager: "scheduleUseAlarmManager": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "speedJumpFilter": 300,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "startOnBoot": true,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "stationaryRadius": 25,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "stopAfterElapsedMinutes": 0,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "stopOnStationary": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "stopOnTerminate": true,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "stopTimeout": 5,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "triggerActivities": "in_vehicle, on_bicycle, on_foot, running, walking",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "url": "",
10-24 12:11:17.188 19578 19647 I TSLocationManager: "useSignificantChangesOnly": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "enabled": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "schedulerEnabled": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "trackingMode": 1,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "odometer": 0,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "isFirstBoot": false,
10-24 12:11:17.188 19578 19647 I TSLocationManager: "didLaunchInBackground": false
10-24 12:11:17.188 19578 19647 I TSLocationManager: }
10-24 12:11:17.188 19578 19647 I TSLocationManager: ╔═════════════════════════════════════════════
10-24 12:11:17.188 19578 19647 I TSLocationManager: ║ DEVICE SENSORS
10-24 12:11:17.188 19578 19647 I TSLocationManager: ╠═════════════════════════════════════════════
10-24 12:11:17.188 19578 19647 I TSLocationManager: ╟─ ✅ ACCELEROMETER: {Sensor name="lsm6ds3c Accelerometer Non-wakeup", vendor="STMicro", version=352, type=1, maxRange=78.4532, resolution=0.0023928226, power=0.15, minDelay=2404}
10-24 12:11:17.188 19578 19647 I TSLocationManager: ╟─ ✅ GYROSCOPE: {Sensor name="lsm6ds3c Gyroscope Non-wakeup", vendor="STMicro", version=352, type=4, maxRange=34.905556, resolution=0.0012216945, power=0.555, minDelay=2404}
10-24 12:11:17.188 19578 19647 I TSLocationManager: ╟─ ✅ MAGNETOMETER: {Sensor name="ak0991x Magnetometer Non-wakeup", vendor="akm", version=10063, type=2, maxRange=4912.0, resolution=0.15, power=1.1, minDelay=10000}
10-24 12:11:17.188 19578 19647 I TSLocationManager: ╟─ ✅ SIGNIFICANT_MOTION: {Sensor name="sns_smd Wakeup", vendor="qualcomm", version=1, type=17, maxRange=1.0, resolution=1.0, power=0.025, minDelay=-1}
10-24 12:11:17.188 19578 19647 I TSLocationManager: ╚═════════════════════════════════════════════
10-24 12:11:17.270 19578 19677 I TSLocationManager: [c.t.l.a.BackgroundGeolocation
One thing what i observed is after scheduled OneShot: STOP_TIMEOUT Motion Transition Result for still did not get fired and if u observe the log 0-24 20:55:21.855 12483 12554 I TSLocationManager: ║ TSLocationManager version: 3.0.37 (337) at this point i brought app from background to foreground and app was restarted
Why are you using stopOnTerminate: true
? startOnBoot: true
is incompatible with stopOnTerminate: true
.
Install latest 3.3.1
just published. I fixed an NPE issue but you're probably not experiencing that since there'd be an Exception stacktrace in the log.
I updated the package and made stopOnTerminate: true & startOnBoot: false,. We will test out and let you know. But one question is why does the app loosing the scope even when its in background just after 4 to 5 mins
But one question is why does the app loosing the scope even when its in background just after 4 to 5 mins
I have no idea but upgrade to latest and go for another test.
@christocracy Even with the new version its the same. On debug build its working but not on the production. App is not active in background
Attach your log file
above is the log if u see one walking event for fired and Motion Transition Result ENTER: still did not get fired after the stopTImeout. And one thing what is observed is when the phone is charging the app is alive and the activity works fine.
DO NOT SPAM THE THREAD WITH IMMENSE LOGS. use Github <details>
tag
logcat
log. Save it to a file and attach the file to this issue. Github supports drag/drop file-upload.
$ adb logcat
Of interest (linked from the excellent dontkillmyapp.com team) https://github.com/DoubleDotLabs/doki
Right on. I figured somebody would do this.
Needs a wrapper for RN, Cordova and Flutter now :)
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.
Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.
App is not active in background on both ios and android
Your Environment
react-native -v
):Plugin config
componentWillMount() { //// // 1. Wire up event-listeners //
}
Expected Behavior
App should be active in background but after few mins (~4-5mins) its loosing scope and when app is brought to foreground its restarting
Actual Behavior
App should be active in background and respond to the motion and activity changes
Steps to Reproduce