nativescript-background-geolocation-lt icon indicating copy to clipboard operation
nativescript-background-geolocation-lt copied to clipboard

Background service dies when opening another activity and then navigating back

Open FranciZ opened this issue 7 years ago • 4 comments

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.

FranciZ avatar Aug 08 '18 18:08 FranciZ

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... (?)

caiusCitiriga avatar Jan 19 '19 01:01 caiusCitiriga

I don’t see how reset:true would help here.

christocracy avatar Jan 19 '19 01:01 christocracy

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.

caiusCitiriga avatar Jan 19 '19 02:01 caiusCitiriga

Can someone share with me a simple test-case app?

christocracy avatar Jan 19 '19 03:01 christocracy