Background service dies when opening another activity and then navigating back
Your Environment
- Plugin version: 1.8.0
- Platform: Anrdoid
- OS version: 8.1
- Device manufacturer / model: Pixel XL 2
- Nativescript version (
tns info): ✔ Getting NativeScript components versions information... ⚠ Update available for component nativescript. Your current version is 4.1.2 and the latest available version is 4.2.0. ✔ Component tns-core-modules has 4.2.0 version and is up to date. ✔ Component tns-android has 4.2.0 version and is up to date. - Plugin config
{
debug: false,
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
stationaryRadius: 25,
distanceFilter: 50,
activityRecognitionInterval: 10000,
notificationText: 'Loco service activated',
notificationIcon: 'drawable/ic_notification',
url: `${config.API_HOST}/v1/game/${this.rootStore.game._id}/player/${this.rootStore.game.gamePlayerId}/location`
}
Expected Behavior
When opening another activity and navigating back to the NativeScript app activity the background service should remain working.
Actual Behavior
Navigating back kills the geolocation background service. The BackgroundGeolocation.getState returns enabled:true but location is not being reported anymore.
Steps to Reproduce
You can use PhotoViewer plugin to open a photo in a new activity and then navigate back.
Debug logs
Nothing unusual in the logs.
Don't know if you still are interested in this, but maybe to someone might interest:
A possible temporary fix might be to force the reset: true when initializing the conf? So it won't care to see the service as alive or not, it will start it anyway... (?)
I don’t see how reset:true would help here.
well, I'm assuming that the main activity on which he "lands back" from the navigation would run the initialization method on the plugin. If I didn't get anything wrong.
Can someone share with me a simple test-case app?