-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Your Environment
- Plugin version: 1.9.1
- Platform: Android
- OS version: 9.0
- Device manufacturer / model: Pixel 2XL Simulator
- Nativescript version (
tns info
):
✔ Getting NativeScript components versions information...
⚠ Update available for component nativescript. Your current version is 5.3.1 and the latest available version is 5.3.2.
✔ Component tns-core-modules has 5.3.1 version and is up to date.
✔ Component tns-android has 5.3.1 version and is up to date.
⚠ Update available for component tns-ios. Your current version is 5.1.0 and the latest available version is 5.3.1.
- Plugin config
// force these settings for each run
reset: true,
// set to true to enable notifications for life-cycle events.
debug: false,
// verbosity of plugins logs
logLevel: this.bgGeo.LOG_LEVEL_NONE,
// highest accuracy
desiredAccuracy: 0,
// minimum number of meters between updates.
//
// FIXME: This can probably be increased.
distanceFilter: 10,
// do not extend updates to just one every km when at speed.
//
// FIXME: trying this to see how it performs.
disableElasticity: true,
// fastest activity recognition
activityRecognitionInterval: 0,
// number of minutes to wait before location services are turned off when device is still.
stopTimeout: 10,
// we do not want to run geolocation if the app terminates
stopOnTerminate: true,
// Minimum confidence for an activity change.
minimumActivityRecognitionConfidence: 75,
// number of minutes to delay stop detection from being activated.
stopDetectionDelay: 10,
// disable accelerometer based stop detection.
//
// FIXME: check this. docs say not recommended.
disableStopDetection: true,
// number of seconds between heart beats.
heartbeatInterval: 60,
// the radius to check for changes in nearby geofences.
//
// 7 km should be a good number. This is checked every 60 seconds.
geofenceProximityRadius: 7000,
// -------------------------------------------
// Android Specific Settings
// make this app mostly immune to memory pressure from other apps.
foregroundService: true,
// -------------------------------------------
// IOS Specific Settings:
//
// this prevents the app from being suspended under iOS when stationary in the background, otherwise if we are still and resume moving
// it'll be 200 meters before the track is accurate.
preventSuspend: true,
// TEMPORARY
disableMotionActivityUpdates: true,
// the minimum distance before tracking is re-enabled after being stationary
stationaryRadius: 15,
Expected Behavior
Same behavior as in Android 8, namely that the app quits completely.
Actual Behavior
If I open the app and do not start geolocation and kill the app by swiping up, it is properly killed and I can restart it and get the expected behavior.
If I open the app, start geolocation, and then swipe the app up, it goes into what appears to be a partially killed state. The app is still listed for a short time in the System -> Developer -> Running Services list but if I then start the app again by tapping the app icon, I continue to get debugging messages from the previous instance and it comes up in an inconsistent state. (firebase complains about being initialized as does sqlite)
If I then swipe the app away again, it properly terminates. I no longer get any debugging messages and if I then tap on the app icon if fires up a fresh instance that works as expected. (firebase and sqlite don't complain about existing connections)
If I set "stopOnTerminate: false", then the app never disappears from the Running Services list no matter how many times I swipe it away. (As I suspect is the intended behavior.)
Under Android 8, even with stopOnTerminate: false and foregroundService: true, the app is properly killed.
Steps to Reproduce
- set stopOnTerminate: true
- start geolocation
- swipe the app away
- fire the app up again.
- Note that it was not killed.
Context
I suspect there is something about Android I do not understand. (This goes back to a documentation issue I filed with the cordova background geolocation project).
My suspicion is that this is probably an Android 9.0 bug or some change I'm unaware of since it works just fine under Android 8.