transistorsoft / cordova-background-geolocation-lt

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
http://www.transistorsoft.com/shop/products/cordova-background-geolocation
Other
658 stars 276 forks source link

Android app is killing and its coming to main page.While running in background #1010

Closed Venkatesh-Veersoftsolutions closed 4 years ago

Venkatesh-Veersoftsolutions commented 4 years ago

Android app is killing and its coming to main page it means like login page.my colleagues are using this tracking plugin in One plus 7 and in vivo mobile. they are getting the problem with background tracking.While running the application in background. (```) . Thank you. -->

Your Environment

Plugin version:3.2.2 Platform: Android OS version:8.0 and above Device manufacturer / model: One plus and vivo Cordova version (cordova -v): 9.0.0 Cordova platform version (cordova platform ls):android 8.1.0 Plugin config provided to #ready:

BackgroundGeolocation.ready({
debug: true,
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
distanceFilter: 0,
locationUpdateInterval: 300000,
startOnBoot: true,
foregroundService: true,
url: url,
autoSync: true,
params: {
tenantId: tenantId,
branchId: branchId,
vsLoginToken: vsLoginToken,
},
allowIdenticalLocations: true,
heartbeatInterval: 300,
stopOnStationary: false,
reset: true
}, (state) => {
console.log('- Configure success: ', state);
this.zone.run(() => {
});
});

Expected Behavior

Should have to work without killing the application while running in the background.

Actual Behavior

After 15 or 30 min application is killing and coming to main screen while running in the background .

Steps to Reproduce

1. 2. 3. 4.

Context

Debug logs

-->

``` PASTE_YOUR_LOGS_HERE I supposed to paste the logs but its colleagues mobile which is not enabled the developer options.
christocracy commented 4 years ago

The OS can and will terminate the MainActivity (where your Cordova JavaScript app lives) when the system is under memory pressure.

The plugin foreground services will remain running and tracking the location as well as uploading to the Config.url.

Are you observing the logs?

Venkatesh-Veersoftsolutions commented 4 years ago

Sorry the application is not killing but its coming to main screen after 15 or 20 min, "main screen " it means first screen in the application.The end user has to see the location updates for longer time.

The tracking is there in third screen in the application.After some time its coming to first screen of the application .

My colleague after she start tracking if she went to some other applications and when she back to tracking application it wont be remain in the same screen where she left. it will come to first screen which is before to login screen.

christocracy commented 4 years ago

If there’s some business logic in your event-handlers, you’ll have to implement that in the plugin Android Headless Mode.

Unfortunately, with Cordova you must write your headless code in Java. With React Native, it can be done with JavaScript.

You must develop your app under the assumption that the OS could terminate the MainActivity,

Venkatesh-Veersoftsolutions commented 4 years ago
BackgroundGeolocation.ready({
      debug: true,
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
      distanceFilter: 0,
      locationUpdateInterval: 300000,
      startOnBoot: true,
      foregroundService: true,
      url: url,
      autoSync: true,
      params: {
        tenantId: tenantId,
        branchId: branchId,
        vsLoginToken: vsLoginToken,
      },
      allowIdenticalLocations: true,
      heartbeatInterval: 300,
      stopOnStationary: false,
      reset: true
    }, (state) => {
      console.log('- Configure success: ', state);
      this.zone.run(() => {
      });
    });

    this.start = true;
    BackgroundGeolocation.start().then((state) => {
      BackgroundGeolocation.changePace(true);
    });
  }

  // Clear the list of events from ion-list
  onClickClear() {
    this.events = [];
  }
  onLocation(location: Location) {
    console.log('[event] location : ', location);
    const event = location.event || 'location';

    this.zone.run(() => {
      if (event === 'location') {
        this.addEvent(event, new Date(location.timestamp), location);
      }
    });
  }

  onHeartBeat(heartBeatEvent: HeartbeatEvent) {
    console.log('[event] heartBeat: ', heartBeatEvent, new Date());
    this.zone.run(() => {
      this.addEvent('heartBeat', new Date(), heartBeatEvent);
    });

    BackgroundGeolocation.getCurrentPosition({}, (location) => {
      console.log('- getCurrentPosition: ', location);
      console.log(`latitude: ${location.coords.latitude}`);
      console.log(`longitude: ${location.coords.longitude}`);
      this.jobService.updateUserLocation(this.tenantId, this.branchId, this.vsLoginToken,
        location.coords.latitude, location.coords.longitude).
        subscribe((res) => {
          console.log(res);
        }, (error) => {
          console.log(`updateUserLocation error: ${error}`);
        });

    }, (error) => {
      console.warn(`- Location error: ${error}`);
    });
  }
  onHttpSuccess(response: HttpEvent) {
    console.log('[event] http: ', response);
    this.zone.run(() => {
      this.addEvent('http', new Date(), response);
    });
  }
  onHttpFailure(response: HttpEvent) {
    console.warn('[event] http failure: ', response);
    this.zone.run(() => {
      this.addEvent('http failure', new Date(), response);
    });
  }
  private addEvent(name, date, event) {
    if (this.events.length >= 50) {
      this.events = [];
    }
    const timestamp = date.toLocaleDateString() + ' ' + date.toLocaleTimeString();

    this.events.unshift({
      name: name,
      timestamp: timestamp,
      object: event,
      content: JSON.stringify(event, null, 2)
    });
  }

  public stopTracking() {
    BackgroundGeolocation.stop();
    this.start = false;
    this.events = [];
  }

}

This is the code which we have for background plugin. I think so there is no any business logic in my code. and i am not getting that, about which event-handlers your talking to.

Venkatesh-Veersoftsolutions commented 4 years ago

10-21 17:52:08.529 12367 12367 I TSLocationManager: [c.t.l.adapter.TSConfig print]
10-21 17:52:08.529 12367 12367 I TSLocationManager: ΓòöΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:52:08.529 12367 12367 I TSLocationManager: Γòæ TSLocationManager version: 3.0.36 (336)
10-21 17:52:08.529 12367 12367 I TSLocationManager: ΓòáΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:52:08.529 12367 12367 I TSLocationManager: {
10-21 17:52:08.529 12367 12367 I TSLocationManager: "activityRecognitionInterval": 10000,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "allowIdenticalLocations": true,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "autoSync": true,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "autoSyncThreshold": 0,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "batchSync": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "debug": true,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "deferTime": 0,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "desiredAccuracy": 0,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "desiredOdometerAccuracy": 100,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "disableElasticity": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "disableLocationAuthorizationAlert": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "disableMotionActivityUpdates": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "disableStopDetection": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "distanceFilter": 0,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "elasticityMultiplier": 1,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "enableHeadless": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "enableTimestampMeta": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "extras": {},
10-21 17:52:08.529 12367 12367 I TSLocationManager: "fastestLocationUpdateInterval": -1,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "forceReloadOnBoot": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "forceReloadOnGeofence": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "forceReloadOnHeartbeat": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "forceReloadOnLocationChange": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "forceReloadOnMotionChange": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "forceReloadOnSchedule": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "foregroundService": true,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "geofenceInitialTriggerEntry": true,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "geofenceModeHighAccuracy": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "geofenceProximityRadius": 1000,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "geofenceTemplate": "",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "headers": {},
10-21 17:52:08.529 12367 12367 I TSLocationManager: "headlessJobService": "com.transistorsoft.cordova.bggeo.BackgroundGeol ocationHeadlessTask",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "heartbeatInterval": 300,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "httpRootProperty": "location",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "httpTimeout": 60000,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "isMoving": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "locationAuthorizationRequest": "Always",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "locationTemplate": "",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "locationTimeout": 60,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "locationUpdateInterval": 300000,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "locationsOrderDirection": "ASC",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "logLevel": 5,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "logMaxDays": 3,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "maxBatchSize": -1,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "maxDaysToPersist": 1,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "maxRecordsToPersist": -1,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "method": "POST",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "minimumActivityRecognitionConfidence": 75,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "notification": {
10-21 17:52:08.529 12367 12367 I TSLocationManager: "layout": "",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "title": "",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "text": "Location Service activated",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "color": "",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "channelName": "TSLocationManager",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "smallIcon": "",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "largeIcon": "",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "priority": 0,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "strings": {},
10-21 17:52:08.529 12367 12367 I TSLocationManager: "actions": []
10-21 17:52:08.529 12367 12367 I TSLocationManager: },
10-21 17:52:08.529 12367 12367 I TSLocationManager: "params": {
10-21 17:52:08.529 12367 12367 I TSLocationManager: "tenantId": "YTE6dnMudGVzdDVAdmVlcnNvZnRzb2x1dGlvbnMuY29t",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "branchId": 5634601401712640,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "vsLoginToken": "lUTloQuhGJnUraGgCs+eC9OkdWHwIk+L+psq8YZGYl0="
10-21 17:52:08.529 12367 12367 I TSLocationManager: },
10-21 17:52:08.529 12367 12367 I TSLocationManager: "persist": true,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "persistMode": 2,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "schedule": [],
10-21 17:52:08.529 12367 12367 I TSLocationManager: "scheduleUseAlarmManager": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "speedJumpFilter": 300,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "startOnBoot": true,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "stationaryRadius": 25,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "stopAfterElapsedMinutes": 0,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "stopOnStationary": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "stopOnTerminate": true,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "stopTimeout": 5,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "triggerActivities": "in_vehicle, on_bicycle, on_foot, running, walkin g",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "url": "https:\/\/servicefolder.appspot.com\/backgroundgeolocation\/lo cationUpdateInterval",
10-21 17:52:08.529 12367 12367 I TSLocationManager: "useSignificantChangesOnly": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "enabled": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "schedulerEnabled": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "trackingMode": 1,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "odometer": 554.1959228515625,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "isFirstBoot": false,
10-21 17:52:08.529 12367 12367 I TSLocationManager: "didLaunchInBackground": false
10-21 17:52:08.529 12367 12367 I TSLocationManager: }
10-21 17:52:08.529 12367 12367 I TSLocationManager: ΓòöΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:52:08.529 12367 12367 I TSLocationManager: Γòæ DEVICE SENSORS
10-21 17:52:08.529 12367 12367 I TSLocationManager: ΓòáΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:52:08.529 12367 12367 I TSLocationManager: ╟─ ✅ ACCELEROMETER: {Sensor name="LSM6DS3 Accelerometer", vendor= "STMicroelectronics", version=1, type=1, maxRange=78.4532, resolution=0.0023956299, power=0.9, minDelay=5000}
10-21 17:52:08.529 12367 12367 I TSLocationManager: ╟─ ✅ GYROSCOPE: {Sensor name="LSM6DS3 Gyroscope", vendor="STMicro electronics", version=1, type=4, maxRange=17.453293, resolution=0.0012207031, power=0.9, minDelay=5000}
10-21 17:52:08.529 12367 12367 I TSLocationManager: ╟─ ✅ MAGNETOMETER: {Sensor name="MMC3416PJ Magnetometer", vendor= "MEMSIC", version=1, type=2, maxRange=1600.0, resolution=0.048828125, power=0.14, minDelay=19230}
10-21 17:52:08.529 12367 12367 I TSLocationManager: ╟─ ✅ SIGNIFICANT_MOTION: {Sensor name="Significant Motion Detecto r", vendor="QTI", version=2, type=17, maxRange=1.0, resolution=1.0, power=0.8999939, minDelay=-1}
10-21 17:52:08.529 12367 12367 I TSLocationManager: ΓòÜΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓò
10-21 17:52:08.541 12367 12367 W TSLocationManager: [c.t.l.service.AbstractService a]
10-21 17:52:08.541 12367 12367 W TSLocationManager: ⚠️ Refusing to start service, enabled: false
10-21 17:52:08.544 12367 12379 I TSLocationManager: [c.t.l.a.BackgroundGeolocation ]
10-21 17:52:08.544 12367 12379 I TSLocationManager: ✅ Google Play Services: connected (version code:12451000)
10-21 17:52:08.554 12367 12367 D TSLocationManager: [c.t.l.service.TrackingService onDestroy]
10-21 17:52:08.554 12367 12367 D TSLocationManager: 🔴 TrackingService destroyed
10-21 17:52:08.559 12367 12386 D TSLocationManager: [c.t.l.data.sqlite.b prune]
10-21 17:52:08.559 12367 12386 D TSLocationManager: ℹ️ PRUNE -1 days
10-21 17:52:08.567 12367 12379 I TSLocationManager: [c.t.l.a.BackgroundGeolocation e]
10-21 17:52:08.567 12367 12379 I TSLocationManager: 🎾 Start monitoring location-provider changes
10-21 17:53:11.895 12367 12367 W TSLocationManager: [c.t.l.service.AbstractService a]
10-21 17:53:11.895 12367 12367 W TSLocationManager: ⚠️ Refusing to start service, enabled: false
10-21 17:53:11.904 12367 12367 D TSLocationManager: [c.t.l.service.TrackingService onDestroy]
10-21 17:53:11.904 12367 12367 D TSLocationManager: 🔴 TrackingService destroyed
10-21 17:53:38.427 12367 12515 D TSLocationManager: $ addLocationListener()
10-21 17:53:38.437 12367 12515 D TSLocationManager: $ addHttpListener()
10-21 17:53:38.439 12367 12515 D TSLocationManager: $ addHeartbeatListener()
10-21 17:53:38.443 12367 12515 D TSLocationManager: $ ready()
10-21 17:53:38.475 12367 12515 D TSLocationManager: [c.t.l.adapter.TSConfig c] ℹ️ Persist config, dirty: [allowIdentic alLocations, debug, distanceFilter, headlessJobService, heartbeatInterval, locationUpdateInterval, logLevel, params, startOn Boot, url]
10-21 17:53:38.478 12367 12790 I TSLocationManager: [c.t.l.http.HttpService flush]
10-21 17:53:38.478 12367 12790 I TSLocationManager: ΓòöΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:53:38.478 12367 12790 I TSLocationManager: Γòæ HTTP Service (count: 0)
10-21 17:53:38.478 12367 12790 I TSLocationManager: ΓòáΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:53:38.482 12367 12789 I TSLocationManager: [c.t.l.http.HttpService flush]
10-21 17:53:38.482 12367 12789 I TSLocationManager: ΓòöΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:53:38.482 12367 12789 I TSLocationManager: Γòæ HTTP Service (count: 0)
10-21 17:53:38.482 12367 12789 I TSLocationManager: ΓòáΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:53:38.489 12367 12515 D TSLocationManager: [c.t.l.a.BackgroundGeolocation ready] LocationPermission :true
10-21 17:53:38.498 12367 12515 D TSLocationManager: $ start()
10-21 17:53:38.500 12367 12515 D TSLocationManager: [c.t.locationmanager.util.b a]
10-21 17:53:38.500 12367 12515 D TSLocationManager: ℹ️ LocationAuthorization: Permission granted
10-21 17:53:38.502 12367 12796 I TSLocationManager: - Enable: false → true, trackingMode: 1
10-21 17:53:38.570 12367 12796 I TSLocationManager: [c.t.l.s.ActivityRecognitionService a]
10-21 17:53:38.570 12367 12796 I TSLocationManager: 🎾 Start motion-activity updates
10-21 17:53:38.598 12367 12796 I TSLocationManager: [c.t.l.g.TSGeofenceManager start]
10-21 17:53:38.598 12367 12796 I TSLocationManager: 🎾 Start monitoring geofences
10-21 17:53:38.611 12367 12796 D TSLocationManager: [c.t.l.http.HttpService startMonitoringConnectivityChanges]
10-21 17:53:38.611 12367 12796 D TSLocationManager: 🎾 Start monitoring connectivity changes
10-21 17:53:38.611 12367 12367 D TSLocationManager: [c.t.l.adapter.TSConfig translateDesiredAccuracy] translateDesiredAccura cy (true): 0
10-21 17:53:38.615 12367 12489 D TSLocationManager: [c.t.l.http.HttpService a]
10-21 17:53:38.615 12367 12489 D TSLocationManager: ΓòöΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:53:38.615 12367 12489 D TSLocationManager: ║ 📶 Connectivity change: connected? true
10-21 17:53:38.615 12367 12489 D TSLocationManager: ΓòáΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:53:38.617 12367 12796 D TSLocationManager: [c.t.locationmanager.device.a c]
10-21 17:53:38.617 12367 12796 D TSLocationManager: 🎾 Start monitoring powersave changes
10-21 17:53:38.618 12367 12489 I TSLocationManager: [c.t.l.http.HttpService flush]
10-21 17:53:38.618 12367 12489 I TSLocationManager: ΓòöΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:53:38.618 12367 12489 I TSLocationManager: Γòæ HTTP Service (count: 0)
10-21 17:53:38.618 12367 12489 I TSLocationManager: ΓòáΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:53:38.627 12367 12796 I TSLocationManager: [c.t.l.g.TSGeofenceManager stopMonitoringSignificantLocationChanges]
10-21 17:53:38.627 12367 12796 I TSLocationManager: 🔴 Stop monitoring significant location changes
10-21 17:53:38.635 12367 12796 I TSLocationManager: [c.t.l.service.HeartbeatService b]
10-21 17:53:38.635 12367 12796 I TSLocationManager: 🎾 Start heartbeat (300s)
10-21 17:53:38.651 12367 12796 D TSLocationManager: [c.t.locationmanager.util.b b]
10-21 17:53:38.651 12367 12796 D TSLocationManager: ℹ️ LocationAuthorization: Permission granted
10-21 17:53:38.652 12367 12796 I TSLocationManager: [c.t.l.service.TrackingService a]
10-21 17:53:38.652 12367 12796 I TSLocationManager: 🔵 setPace: false → false
10-21 17:53:38.684 12367 12515 D TSLocationManager: $ changePace()
10-21 17:53:38.691 12367 12796 D TSLocationManager: [c.t.l.adapter.TSConfig c] ℹ️ Persist config, dirty: [isMoving]
10-21 17:53:38.694 12367 12796 I TSLocationManager: [c.t.l.service.HeartbeatService a]
10-21 17:53:38.694 12367 12796 I TSLocationManager: 🔴 Stop heartbeat
10-21 17:53:38.703 12367 12796 D TSLocationManager: [c.t.l.g.TSGeofenceManager stopMonitoringStationaryRegion]
10-21 17:53:38.703 12367 12796 D TSLocationManager: 🔴 Stop monitoring stationary region
10-21 17:53:38.719 12367 12796 I TSLocationManager: [c.t.l.s.ActivityRecognitionService a]
10-21 17:53:38.719 12367 12796 I TSLocationManager: 🎾 Start motion-activity updates
10-21 17:53:38.722 12367 12796 D TSLocationManager: [c.t.locationmanager.util.b b]
10-21 17:53:38.722 12367 12796 D TSLocationManager: ℹ️ LocationAuthorization: Permission granted
10-21 17:53:38.724 12367 12796 I TSLocationManager: [c.t.l.service.TrackingService a]
10-21 17:53:38.724 12367 12796 I TSLocationManager: 🔵 setPace: false → true
10-21 17:53:38.740 12367 12367 I TSLocationManager: [c.t.l.service.TrackingService h]
10-21 17:53:38.740 12367 12367 I TSLocationManager: ΓòöΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:53:38.740 12367 12367 I TSLocationManager: Γòæ TrackingService motionchange: true
10-21 17:53:38.740 12367 12367 I TSLocationManager: ΓòáΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ ΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉΓòÉ
10-21 17:53:38.854 12367 12367 D TSLocationManager: [c.t.l.s.ActivityRecognitionService a]
10-21 17:53:38.854 12367 12367 D TSLocationManager: 🚘 ️DetectedActivity [type=STILL, confidence=100]
10-21 17:53:39.060 12367 12802 I TSLocationManager: [c.t.l.s.LocationRequestService b]

These are my logs . its coming to main page after some time and its stopping the tracking.

christocracy commented 4 years ago

@Venkatesh-Veersoftsolutions Why are you doing this in your app? It's code copy/pasted from the sample app so it can render a list of locations for people demo-ing the plugin. If you're not using that code, get rid of it.

Also, you probably want to configure stopOnTerminate: true

onHttpSuccess(response: HttpEvent) {
    console.log('[event] http: ', response);
    this.zone.run(() => {
      this.addEvent('http', new Date(), response);
    });
  }
  onHttpFailure(response: HttpEvent) {
    console.warn('[event] http failure: ', response);
    this.zone.run(() => {
      this.addEvent('http failure', new Date(), response);
    });
  }
  private addEvent(name, date, event) {
    if (this.events.length >= 50) {
      this.events = [];
    }
    const timestamp = date.toLocaleDateString() + ' ' + date.toLocaleTimeString();

    this.events.unshift({
      name: name,
      timestamp: timestamp,
      object: event,
      content: JSON.stringify(event, null, 2)
    });
Venkatesh-Veersoftsolutions commented 4 years ago

Controls whether to continue location-tracking after application is terminated.

Defaults to true. When the user terminates the app, the plugin will BackgroundGeolocation.stop tracking. Set this to false to continue tracking after application terminate.

here is your documentation it is telling that by default its in true.then the location will be stopped after the application is terminated.now user need locations for long time so i have to set it to false according to your documentation .

christocracy commented 4 years ago

stopOnTerminate defaults to true.

Ask yourself: "Do I want the plugin to stop when the app terminates?". true or false?

Venkatesh-Veersoftsolutions commented 4 years ago

Obviously it should be false. The user will get the location updates after terminating the application.because now the application is closing and its coming to main screen.

My main problem is the application is coming to main page ,and stops tracking .pls see my logs and help me.

christocracy commented 4 years ago

I don’t know anything about this “coming to main page”. Yes, Android can terminate your Cordova app when under memory pressure. With stopOnTerminate: false, the plugin’s native Android services remain running and tracking.

It doesn’t mean your Cordova JavaScript app cant be terminated, it can and will.

christocracy commented 4 years ago

Now that you know about stopOnTerminate: false, go outside for a nice long field test and gather more logs.

stale[bot] commented 4 years ago

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.

stale[bot] commented 4 years ago

Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.