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
656 stars 277 forks source link

Background Geo Location Not tracking after 5 Minutes in background #1450

Closed kmanikandan8122 closed 4 weeks ago

kmanikandan8122 commented 1 month ago

Your Environment

----------Package.Json--------------------------- { "name": "AllTrans", "version": "0.0.1", "author": "Ionic Framework", "homepage": "https://ionicframework.com/", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test", "lint": "ng lint" }, "private": true, "dependencies": { "@angular/common": "^13.3.10", "@angular/core": "^13.3.10", "@angular/forms": "^13.3.10", "@angular/platform-browser": "^13.3.10", "@angular/platform-browser-dynamic": "^13.3.10", "@angular/router": "^13.3.10", "@awesome-cordova-plugins/android-permissions": "^6.2.0", "@awesome-cordova-plugins/app-version": "^6.2.0", "@awesome-cordova-plugins/background-geolocation": "^6.2.0", "@awesome-cordova-plugins/core": "^6.2.0", "@awesome-cordova-plugins/device": "^6.2.0", "@awesome-cordova-plugins/diagnostic": "^6.2.0", "@awesome-cordova-plugins/fcm": "^6.3.0", "@awesome-cordova-plugins/foreground-service": "^6.7.0", "@awesome-cordova-plugins/geolocation": "^6.2.0", "@awesome-cordova-plugins/in-app-browser": "^6.3.0", "@awesome-cordova-plugins/location-accuracy": "^6.2.0", "@awesome-cordova-plugins/screen-orientation": "^6.2.0", "@awesome-cordova-plugins/splash-screen": "^6.3.0", "@awesome-cordova-plugins/sqlite": "^6.2.0", "@awesome-cordova-plugins/status-bar": "^6.2.0", "@ionic-native/core": "^5.36.0", "@ionic-native/device": "^5.36.0", "@ionic-native/fcm": "^5.36.0", "@ionic-native/file": "^5.36.0", "@ionic-native/file-opener": "^5.36.0", "@ionic-native/foreground-service": "^5.36.0", "@ionic-native/geolocation": "^5.36.0", "@ionic-native/location-accuracy": "^5.36.0", "@ionic-native/native-storage": "^5.36.0", "@ionic-native/network": "^5.36.0", "@ionic-native/splash-screen": "^5.36.0", "@ionic/angular": "^6.1.9", "@ionic/cordova-builders": "^7.0.0", "@ionic/storage": "^3.0.6", "@ionic/storage-angular": "^3.0.6", "angular2-signaturepad": "^3.0.4", "cordova-background-geolocation-lt": "^4.10.0", "cordova-browser": "6.0.0", "cordova-plugin-fcm-with-dependecy-updated": "^7.8.0", "cordova-plugin-firebasex": "^16.0.0", "cordova-plugin-foreground-service": "^1.1.3", "cordova-plugin-network-information": "^3.0.0", "date-fns": "^2.29.3", "ionicons": "^6.0.3", "jquery": "^3.6.3", "moment": "^2.29.4", "mydatepicker": "^9.0.2", "rxjs": "^6.5.3", "tslib": "^2.3.0", "zone.js": "~0.11.4" }, "devDependencies": { "@angular-devkit/build-angular": "^13.3.10", "@angular-eslint/builder": "^13.3.10", "@angular-eslint/eslint-plugin": "^13.3.10", "@angular-eslint/eslint-plugin-template": "^13.3.10", "@angular-eslint/template-parser": "^13.3.10", "@angular/cli": "^13.3.10", "@angular/compiler": "^13.3.10", "@angular/compiler-cli": "^13.3.10", "@angular/language-service": "^13.3.10", "@ionic-native/background-geolocation": "^5.36.0", "@ionic/angular-toolkit": "^6.0.0", "@types/jasmine": "~4.0.0", "@types/node": "^12.11.1", "@typescript-eslint/eslint-plugin": "5.3.0", "@typescript-eslint/parser": "5.3.0", "cordova-android": "^10.1.2", "cordova-ios": "^6.2.0", "cordova-plugin-android-permissions": "^1.1.5", "cordova-plugin-app-version": "^0.1.14", "cordova-plugin-background-fetch": "^7.1.2", "cordova-plugin-badge-fix": "^0.8.10", "cordova-plugin-device": "2.0.2", "cordova-plugin-file": "^7.0.0", "cordova-plugin-file-opener2": "^4.0.0", "cordova-plugin-geolocation": "^4.1.0", "cordova-plugin-inappbrowser": "^5.0.0", "cordova-plugin-ionic-keyboard": "^2.0.5", "cordova-plugin-ionic-webview": "^5.0.0", "cordova-plugin-local-notification-12": "^0.1.4", "cordova-plugin-mauron85-background-geolocation": "^3.0.1", "cordova-plugin-nativestorage": "^2.3.2", "cordova-plugin-request-location-accuracy": "^2.3.0", "cordova-plugin-screen-orientation": "^3.0.2", "cordova-plugin-splashscreen": "5.0.2", "cordova-plugin-statusbar": "^2.4.2", "cordova-sqlite-storage": "^6.1.0", "cordova.plugins.diagnostic": "^7.1.1", "es6-promise-plugin": "^4.2.2", "eslint": "^7.6.0", "eslint-plugin-import": "2.22.1", "eslint-plugin-jsdoc": "30.7.6", "eslint-plugin-prefer-arrow": "1.2.2", "jasmine-core": "~4.3.0", "jasmine-spec-reporter": "~5.0.0", "karma": "~6.4.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.2.0", "karma-coverage-istanbul-reporter": "~3.0.2", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.0.0", "ts-node": "~8.3.0", "typescript": "~4.4.4" }, "description": "An Ionic project", "cordova": { "plugins": { "cordova-plugin-statusbar": {}, "cordova-plugin-device": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-ionic-webview": {}, "cordova-plugin-ionic-keyboard": {}, "cordova-plugin-nativestorage": {}, "cordova-plugin-request-location-accuracy": { "PLAY_SERVICES_LOCATION_VERSION": "16.+" }, "cordova-plugin-screen-orientation": {}, "cordova.plugins.diagnostic": {}, "cordova-sqlite-storage": {}, "cordova-plugin-geolocation": { "GPS_REQUIRED": "true" }, "cordova-plugin-app-version": {}, "cordova-plugin-android-permissions": {}, "cordova-plugin-fcm-with-dependecy-updated": { "ANDROID_FCM_VERSION": "19.0.0", "ANDROID_GRADLE_TOOLS_VERSION": "3.5.3", "ANDROID_GOOGLE_SERVICES_VERSION": "4.3.3", "ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher", "ANDROID_FIREBASE_BOM_VERSION": "26.0.0" }, "cordova-plugin-network-information": {}, "cordova-background-geolocation-lt": { "GOOGLE_API_VERSION": "20.+", "OKHTTP_VERSION": "3.12.+", "EVENTBUS_VERSION": "3.3.1" }, "cordova-plugin-local-notification-12": { "ANDROID_SUPPORT_V4_VERSION": "26.+", "ANDROIDX_VERSION": "1.2.0", "ANDROIDX_APPCOMPAT_VERSION": "1.3.1" }, "cordova-plugin-firebasex": { "FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true", "FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "true", "FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "true", "FIREBASE_FCM_AUTOINIT_ENABLED": "true", "ANDROID_ICON_ACCENT": "#FF00FFFF", "ANDROID_FIREBASE_PERFORMANCE_MONITORING": "false", "ANDROID_PLAY_SERVICES_TAGMANAGER_VERSION": "18.0.2", "ANDROID_PLAY_SERVICES_AUTH_VERSION": "20.4.0", "ANDROID_FIREBASE_ANALYTICS_VERSION": "21.2.0", "ANDROID_FIREBASE_MESSAGING_VERSION": "23.1.0", "ANDROID_FIREBASE_CONFIG_VERSION": "21.2.0", "ANDROID_FIREBASE_PERF_VERSION": "20.3.0", "ANDROID_FIREBASE_AUTH_VERSION": "21.1.0", "ANDROID_FIREBASE_INAPPMESSAGING_VERSION": "20.2.0", "ANDROID_FIREBASE_FIRESTORE_VERSION": "24.4.1", "ANDROID_FIREBASE_FUNCTIONS_VERSION": "20.2.1", "ANDROID_FIREBASE_IID_VERSION": "21.1.0", "ANDROID_FIREBASE_INSTALLATIONS_VERSION": "17.1.0", "ANDROID_FIREBASE_CRASHLYTICS_VERSION": "18.3.2", "ANDROID_FIREBASE_CRASHLYTICS_NDK_VERSION": "18.3.2", "ANDROID_GSON_VERSION": "2.9.0", "ANDROID_FIREBASE_PERF_GRADLE_PLUGIN_VERSION": "1.4.2", "ANDROID_GRPC_OKHTTP": "1.46.0" }, "cordova-plugin-file": { "ANDROIDX_WEBKIT_VERSION": "1.4.0" }, "cordova-plugin-file-opener2": {}, "cordova-plugin-inappbrowser": {}, "cordova-plugin-background-fetch": {}, "cordova-plugin-foreground-service": {} }, "platforms": [ "ios", "browser", "android" ] } }

Expected Behavior 1.We need to track the user location when the app is running in foreground or background. 2.update the location when the device is on or lock or sleep. Actual Behavior 1.Location is tracked only when the app is running in foreground. 2.once the device is locked and app is running in the background location is not tracked after 5minutes. we tried to move with bike around 10 kms no update after 5 minutes and notification also not showing

Expected Behavior

Need to track live location of the user even stationary position ,we have a functionality like transportation tracking

Steps to Reproduce

1. 2. 3. 4.

Context

Logs ``` PASTE_YOUR_LOGS_HERE ```
christocracy commented 1 month ago

4.10.0.

That version dates back to 2023-02-01

The latest version is 4.16.5

Device manufacturer / model:Oppo/Samsung,Vivo,Redmin

See https://dontkillmyapp.com

Testing this plugin requires real movement outside, at least 200 meters before tracking engages.

Also see Wiki "Debugging" and learn to fetch your logs with .emailLog method (search the API docs for more information).

christocracy commented 1 month ago

Also read the Wiki "Philosophy of Operation" and learn about what Config.stopTimeout means (search the API docs).

kmanikandan8122 commented 1 month ago

Any additional plugin like Background fetch or background mode is required for to keep this plugin as active?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Chris Scott @.> Sent: Thursday, June 27, 2024 7:59:35 PM To: transistorsoft/cordova-background-geolocation-lt @.> Cc: Manikandan K @.>; Author @.> Subject: Re: [transistorsoft/cordova-background-geolocation-lt] Background Geo Location Not tracking after 5 Minutes in background (Issue #1450)

4.10.0.

That version dates back to 2023-02-01https://github.com/transistorsoft/cordova-background-geolocation-lt/blob/master/CHANGELOG.md#4100--2023-02-01

The latest version is 4.16.5https://github.com/transistorsoft/cordova-background-geolocation-lt/blob/master/CHANGELOG.md#4165--2024-06-12

Device manufacturer / model:Oppo/Samsung,Vivo,Redmin

See https://dontkillmyapp.com

Testing this plugin requires real movement outside, at least 200 meters before tracking engages.

Also see Wiki "Debugging" and learn to fetch your logs with .emailLog method (search the API docs for more information).

— Reply to this email directly, view it on GitHubhttps://github.com/transistorsoft/cordova-background-geolocation-lt/issues/1450#issuecomment-2194874602, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJPXRPEUZSRR6PBT275XQCLZJQOU7AVCNFSM6AAAAABKABHNTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJUHA3TINRQGI. You are receiving this because you authored the thread.Message ID: @.***>

christocracy commented 1 month ago

Any additional plugin like Background fetch or background mode is required for to keep this plugin as active?

No.

Do you know what Config.stopTimeout means? Did you read and understand the Philosophy of Operation?

christocracy commented 1 month ago

Are you on the same team as @Rajam0310? You're both posting similar issues using the same old version 4.10.0. See #1449

kmanikandan8122 commented 1 month ago

Yes I understand we have to move 200 mts from last known position.i moved from more than 200 mts but the tracking is stopped and I am not seeing notification in tray which is closed automatically any permission I have to give or anything need to add it in config file?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Chris Scott @.> Sent: Thursday, June 27, 2024 8:10:26 PM To: transistorsoft/cordova-background-geolocation-lt @.> Cc: Manikandan K @.>; Author @.> Subject: Re: [transistorsoft/cordova-background-geolocation-lt] Background Geo Location Not tracking after 5 Minutes in background (Issue #1450)

Any additional plugin like Background fetch or background mode is required for to keep this plugin as active?

No.

Do you know what Config.stopTimeout means? Did you read and understand the Philosophy of Operation?

— Reply to this email directly, view it on GitHubhttps://github.com/transistorsoft/cordova-background-geolocation-lt/issues/1450#issuecomment-2194910438, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJPXRPDLTGAEIRPGMFIW53TZJQP5VAVCNFSM6AAAAABKABHNTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJUHEYTANBTHA. You are receiving this because you authored the thread.Message ID: @.***>

christocracy commented 1 month ago

I asked you two questions:

  1. Do you know what Config.stopTimeout means?
  2. Did you read and understand the Philosophy of Operation?
christocracy commented 1 month ago

Also learn to observe the plugin logs. See Wiki "Debugging". Learn to use the .emailLog method. Search it in the API docs, linked at the top of the README here.

christocracy commented 1 month ago

I also asked:

Are you on the same team as @Rajam0310?

kmanikandan8122 commented 1 month ago

1 I don't know 2 I know

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Chris Scott @.> Sent: Thursday, June 27, 2024 8:15:39 PM To: transistorsoft/cordova-background-geolocation-lt @.> Cc: Manikandan K @.>; Author @.> Subject: Re: [transistorsoft/cordova-background-geolocation-lt] Background Geo Location Not tracking after 5 Minutes in background (Issue #1450)

I asked you two questions:

  1. Do you know what Config.stopTimeout means?
  2. Did you read and understand the Philosophy of Operation?

— Reply to this email directly, view it on GitHubhttps://github.com/transistorsoft/cordova-background-geolocation-lt/issues/1450#issuecomment-2194921707, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJPXRPFPD6GCQU2OTIDRG2DZJQQRHAVCNFSM6AAAAABKABHNTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJUHEZDCNZQG4. You are receiving this because you authored the thread.Message ID: @.***>

kmanikandan8122 commented 1 month ago

Yes

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Chris Scott @.> Sent: Thursday, June 27, 2024 8:17:04 PM To: transistorsoft/cordova-background-geolocation-lt @.> Cc: Manikandan K @.>; Author @.> Subject: Re: [transistorsoft/cordova-background-geolocation-lt] Background Geo Location Not tracking after 5 Minutes in background (Issue #1450)

I also asked:

Are you on the same team as @Rajam0310https://github.com/Rajam0310?

— Reply to this email directly, view it on GitHubhttps://github.com/transistorsoft/cordova-background-geolocation-lt/issues/1450#issuecomment-2194925316, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJPXRPG6TWKYO6DT36KSBGTZJQQWRAVCNFSM6AAAAABKABHNTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJUHEZDKMZRGY. You are receiving this because you authored the thread.Message ID: @.***>

christocracy commented 1 month ago

Are you on the same team as @Rajam0310? Yes

Don't open multiple issues about the thing. It pisses me off.

christocracy commented 1 month ago

Do you know what Config.stopTimeout means?

1 I don't know

Learn about it.

kmanikandan8122 commented 1 month ago

using lockito app we are simulating the location update but the location event is not fired

import { Component } from '@angular/core'; import { Platform } from '@ionic/angular'; import BackgroundGeolocation from 'cordova-background-geolocation-lt';

@Component({ selector: 'app-root', templateUrl: 'app.component.html', styleUrls: ['app.component.scss'], }) export class AppComponent { constructor(private platform: Platform) { this.initializeApp(); }

initializeApp() { this.platform.ready().then(() => { this.backgroundGPS(); }); }

async backgroundGPS() { console.log('Function call');

try {
  const state = await BackgroundGeolocation.ready({
    distanceFilter: 0,
    debug: true, // Enable debug to see plugin logs
    fastestLocationUpdateInterval: 30000, // 30 seconds
    foregroundService: true,
    locationUpdateInterval: 30000, // 30 seconds
    startOnBoot: true,
    stopOnTerminate: false,
    locationAuthorizationRequest: 'Always',
    notification: {
      title: "AllTrans GPS Tracking",
      text: "Live Location Sharing",
      priority: BackgroundGeolocation.NOTIFICATION_PRIORITY_HIGH,
    },
    backgroundPermissionRationale: {
      title: "Allow AllTrans to access to this device's location in the background?",
      message: "In order to track your activity in the background, please enable 'Allow all the time' location permission",
    }
  });

  BackgroundGeolocation.on('location', location => {
    console.log('Location update:', location);
    // Handle location updates here
  });

  BackgroundGeolocation.on('error', error => {
    console.error('Background Geolocation error:', error);
  });

  BackgroundGeolocation.on('motionchange', isMoving => {
    console.log('Motion change:', isMoving);
  });

  BackgroundGeolocation.on('activitychange', activity => {
    console.log('Activity change:', activity);
  });

  BackgroundGeolocation.on('providerchange', provider => {
    console.log('Provider change:', provider);
  });

  BackgroundGeolocation.start();
  console.log('Background Geolocation started:', state);
} catch (error) {
  console.error('Error starting Background Geolocation:', error);
}

} }

christocracy commented 4 weeks ago

using lockito app we are simulating the location update but the location event is not fired

The plugin turns on the Location API to listen for incoming mocked locations only under the following conditions:

  1. Motion API reports the device is moving. The Motion API uses the accelerometer, gyroscope and magnetometer to detect movement. If your device is sitting stationary on your desk, the plugin isn't listening to your mocked locations from Lockito. You can simulate motion by shaking your device vigorously for 30-60 seconds.
  2. A geofence around the last known position. When the device exits this geofence, the device is detected to be moving. Geofences are often not triggered by mocked locations.
  3. You can manually toggle the plugin into the moving state by calling the method .changePace(true).

This is all documented in the WIki "Debugging"

Screenshot 2024-06-28 at 9 53 01 AM

The best way to test the true behaviour of this plugin is with real movement outside (walking at least 200 meters) with a real device.

kmanikandan8122 commented 4 weeks ago

Thank for the reply and I read one method that is time-based tracking,for that I changed configure like distance filter as 0 and locationupdate interval as 3000ms .My query is for that also I have to move 200 mts or every 3000 ms location I can track the location?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Chris Scott @.> Sent: Friday, June 28, 2024 7:24:09 PM To: transistorsoft/cordova-background-geolocation-lt @.> Cc: Manikandan K @.>; Author @.> Subject: Re: [transistorsoft/cordova-background-geolocation-lt] Background Geo Location Not tracking after 5 Minutes in background (Issue #1450)

using lockito app we are simulating the location update but the location event is not fired

The plugin turns on the Location API to listen for incoming mocked locations only under the following conditions:

  1. Motion API reports the device is moving. The Motion API uses the accelerometer, gyroscope and magnetometer to detect movement. If your device is sitting stationary on your desk, the plugin isn't listening to your mocked locations from Lockito. You can simulate motion by shaking your device vigorously for 30-60 seconds.
  2. A geofence around the last known position. When the device exits this geofence, the device is detected to be moving. Geofences are often not triggered by mocked locations.
  3. You can manually toggle the plugin into the moving state by calling the method .changePace(true).

This is all documented in the WIki "Debugging"https://github.com/transistorsoft/cordova-background-geolocation-lt/wiki/Debugging

Screenshot.2024-06-28.at.9.53.01.AM.png (view on web)https://github.com/transistorsoft/cordova-background-geolocation-lt/assets/14999/91932dba-4063-430f-bbcd-62de4d82a982

The best way to test the true behaviour of this plugin is with real movement outside (walking at least 200 meters) with a real device.

— Reply to this email directly, view it on GitHubhttps://github.com/transistorsoft/cordova-background-geolocation-lt/issues/1450#issuecomment-2196976906, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJPXRPC3I7WJYPF2KRXNZO3ZJVTIDAVCNFSM6AAAAABKABHNTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJWHE3TMOJQGY. You are receiving this because you authored the thread.Message ID: @.***>

christocracy commented 4 weeks ago

Read and understand the plugin's Philosophy of Operation.

You do not understand how this plugin operates. The plugin strongly desires to conserve energy. When the device is sitting stationary, LOCATION SERVICES ARE OFF -- THE PLUGIN IS NOT RECORDING LOCATIONS.

My query is for that also I have to move 200 mts or every 3000 ms location I can track the location?

Yes. Or learn to manually change to the moving state via method .changePace(true).

I don't think you're actually reading and understand what I tell you.

kmanikandan8122 commented 4 weeks ago

My requirement is have to get gps position even idle or movement state,if I am not moving for longer time also i need gps position.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Chris Scott @.> Sent: Friday, June 28, 2024 7:51:18 PM To: transistorsoft/cordova-background-geolocation-lt @.> Cc: Manikandan K @.>; Author @.> Subject: Re: [transistorsoft/cordova-background-geolocation-lt] Background Geo Location Not tracking after 5 Minutes in background (Issue #1450)

Read and understand the plugin's Philosophy of Operationhttps://github.com/transistorsoft/cordova-background-geolocation-lt/wiki/Philosophy-of-Operation.

You do not understand how this plugin operates. The plugin strongly desires to conserve energy. When the device is sitting stationary, LOCATION SERVICES ARE OFF -- THE PLUGIN IS NOT RECORDING LOCATIONS.

My query is for that also I have to move 200 mts or every 3000 ms location I can track the location?

Yes. Or learn to manually change to the moving state via method .changePace(true).

I don't think you're actually reading and understand what I tell you.

— Reply to this email directly, view it on GitHubhttps://github.com/transistorsoft/cordova-background-geolocation-lt/issues/1450#issuecomment-2197053395, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BJPXRPBO4N5YYEXJ6NU363DZJVWN5AVCNFSM6AAAAABKABHNTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJXGA2TGMZZGU. You are receiving this because you authored the thread.Message ID: @.***>

christocracy commented 4 weeks ago

The BackgroundGeolocation plugin is not interested in tracking the location when the device is known to be stationary.

You must implement background-fetch plugin (already included as a dependency) for periodic callbacks (eg: every 15 min). You are free to call bgGeo.getCurrentPosition(args) in your background-fetch callback.