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

How to get physical activity user permission in Android 11 (SDK 30) #1288

Closed G93692 closed 2 years ago

G93692 commented 2 years ago

Your Environment

Actual Behavior

If user select "Allow only while using the app" Location permission while BackgroundGeolocation.start() is called. It never ask for "Physical Activity" permission.

Steps to Reproduce

  1. After install the app in Android 11 device, 1st time user start the BackgroundGeolocation
  2. Location permission popup shown in Android11 (Android SDK 30)
  3. if user select "Allow only while using the app"
  4. "Physical Activity" permission never asked.
  5. In app info "Physical Activity" permission is set as "Deny"

Context

Android11 (Android SDK 30) Location permission

Debug logs

Logs ``` PASTE_YOUR_LOGS_HERE ```
christocracy commented 2 years ago

Are you using a 3rd party library to request location permission?

christocracy commented 2 years ago

Cordova version (cordova -v): latest Cordova platform version (cordova platform ls): latest

This is meaningless information. Do not write "latest".

G93692 commented 2 years ago

Chris - we are not using any 3rd party library to request location permission. It is a Capacitor App. Please find the plugin version:

"dependencies": { "@capacitor/android": "^3.1.2", "@capacitor/cli": "^2.0.1", "@capacitor/core": "^2.4.0", "@capacitor/ios": "^2.2.1", "@ionic-native/core": "^5.27.0", "@ionic/react": "^4.11.10", "@ionic/react-hooks": "0.0.6", "@ionic/react-router": "^4.11.10", "@types/node": "^12.12.37", "@types/react": "^16.9.34", "@types/react-dom": "^16.9.7", "@types/react-redux": "^7.1.7", "@types/react-router": "^5.1.7", "@types/react-router-dom": "^5.1.5", "cordova-background-geolocation-lt": "^4.1.2", "cordova-plugin-background-fetch": "^7.0.3", "json-to-graphql-query": "^2.0.0", "node-sass": "^4.14.1", "npm": "^6.14.7", },

christocracy commented 2 years ago

Post the following files:

G93692 commented 2 years ago

android/build.gradle:


buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
        classpath 'com.google.gms:google-services:4.3.3'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

apply from: "variables.gradle"

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

android/app/build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    defaultConfig {
        applicationId "XXXXXXXX"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode= 1
        versionName="XXXXXX"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {

    flatDir{
        dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
    implementation project(':capacitor-android')
    testImplementation "junit:junit:$junitVersion"
    androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
    androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
    implementation project(':capacitor-cordova-android-plugins')
}

apply from: 'capacitor.build.gradle'
christocracy commented 2 years ago

You've posted AndroidManifest.xml, not android/build.gradle

G93692 commented 2 years ago

Please find the android/build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
        classpath 'com.google.gms:google-services:4.3.3'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

apply from: "variables.gradle"

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
christocracy commented 2 years ago

post android/variables.gradle

G93692 commented 2 years ago

Please find post android/variables.gradle

ext { minSdkVersion = 21 compileSdkVersion = 30 targetSdkVersion = 30 androidxAppCompatVersion = '1.1.0' androidxCoreVersion = '1.2.0' androidxMaterialVersion = '1.1.0-rc02' androidxBrowserVersion = '1.2.0' androidxLocalbroadcastmanagerVersion = '1.0.0' firebaseMessagingVersion = '20.1.6' playServicesLocationVersion = '17.0.0' junitVersion = '4.12' androidxJunitVersion = '1.1.1' androidxEspressoCoreVersion = '3.2.0' cordovaAndroidVersion = '7.0.0' }

christocracy commented 2 years ago

See wiki Debugging and gather logs from $ adb logcat *:S TSLocationManager:V

G93692 commented 2 years ago

Please find the logcat logs:

2021-07-23 22:37:14.798 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ addLocationListener() 2021-07-23 22:37:14.817 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ addMotionChangeListener() 2021-07-23 22:37:14.835 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ addActivityChangeListener() 2021-07-23 22:37:14.840 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ addProviderChangeListener() 2021-07-23 22:37:14.848 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ addScheduleListener() 2021-07-23 22:37:14.866 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ addHttpListener() 2021-07-23 22:37:14.885 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ addGeofenceListener() 2021-07-23 22:37:14.932 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ ready() 2021-07-23 22:37:15.045 26355-26697/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ℹ️ Persist config, dirty: [] 2021-07-23 22:37:15.056 26355-26697/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ℹ️ Persist config, dirty: [headlessJobService] 2021-07-23 22:37:15.056 26355-26697/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ✅ Google Play Services: connected (version code:12451000) 2021-07-23 22:37:15.057 26355-26697/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 🎾 Start monitoring location-provider changes 2021-07-23 22:37:15.071 26355-26697/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] CREATE TABLE IF NOT EXISTS locations (id INTEGER PRIMARY KEY AUTOINCREMENT, uuid TEXT NOT NULL DEFAULT '', timestamp TEXT, json TEXT, data BLOB, encrypted BOOLEAN NOT NULL DEFAULT 0, locked BOOLEAN NOT NULL DEFAULT 0); 2021-07-23 22:37:15.081 26355-26697/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] CREATE TABLE IF NOT EXISTS geofences (id INTEGER PRIMARY KEY AUTOINCREMENT, identifier TEXT NOT NULL UNIQUE, latitude DOUBLE NOT NULL, sin_latitude DOUBLE NOT NULL, cos_latitude DOUBLE NOT NULL, longitude DOUBLE NOT NULL, sin_longitude DOUBLE NOT NULL, cos_longitude DOUBLE NOT NULL, radius DOUBLE NOT NULL, notifyOnEntry BOOLEAN NOT NULL DEFAULT 0, notifyOnExit BOOLEAN NOT NULL DEFAULT 0, notifyOnDwell BOOLEAN NOT NULL DEFAULT 0, loiteringDelay INTEGER NOT NULL DEFAULT 0, extras TEXT); 2021-07-23 22:37:15.083 26355-26697/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ℹ️ PRUNE -1 days 2021-07-23 22:37:15.090 26355-26697/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ℹ️ Persist config, dirty: [allowIdenticalLocations, backgroundPermissionRationale, backgroundPermissionRationale.title, backgroundPermissionRationale.message, backgroundPermissionRationale.negativeAction, desiredAccuracy, disableElasticity, distanceFilter, extras, headers, logLevel, startOnBoot, stopOnTerminate, url] 2021-07-23 22:37:15.091 26355-26697/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 2021-07-23 22:37:15.356 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ setConfig() 2021-07-23 22:37:15.358 26355-26608/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.adapter.TSConfig d] ℹ️ Persist config, dirty: [headers] 2021-07-23 22:37:15.375 26355-26355/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 2021-07-23 22:38:53.561 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 22:38:53.570 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 22:38:53.577 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 22:38:55.571 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ getCurrentPosition() 2021-07-23 22:38:55.587 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ getCurrentPosition() 2021-07-23 22:38:55.598 26355-26824/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c f] 🔵 LocationAuthorization: Requesting permission 2021-07-23 22:38:55.598 26355-26825/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c f] 🔵 LocationAuthorization: Requesting permission 2021-07-23 22:38:59.911 26355-26355/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c$i onPermissionGranted] ✅ LocationAuthorization: Permission granted 2021-07-23 22:39:00.962 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 22:39:00.970 26355-26827/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService a] ℹ️ Location availability: true 2021-07-23 22:39:00.971 26355-26827/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 22:39:00.975 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 22:39:00.983 26355-26844/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService a] ℹ️ Location availability: true 2021-07-23 22:39:00.985 26355-26844/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 22:39:01.242 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed 2021-07-23 22:39:05.128 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 22:39:05.132 26355-26845/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService b] ╔═════════════════════════════════════════════ ║ getCurrentPosition LocationResult: 1 ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 37.336973,-121.978238 hAcc=5 et=+11h43m50s341ms alt=0.0 vel=0.0 bear=0.0 vAcc=1 sAcc=1 bAcc=30 {Bundle[mParcelledData.dataSize=52]}], age: 83ms, time: 1627060145030 2021-07-23 22:39:05.136 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 2] 2021-07-23 22:39:05.139 26355-26824/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService b] ╔═════════════════════════════════════════════ ║ getCurrentPosition LocationResult: 2 ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 37.336973,-121.978238 hAcc=5 et=+11h43m50s341ms alt=0.0 vel=0.0 bear=0.0 vAcc=1 sAcc=1 bAcc=30 {Bundle[mParcelledData.dataSize=52]}], age: 91ms, time: 1627060145030 2021-07-23 22:39:05.141 26355-26845/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.l.TSLocationManager onSingleLocationResult] 🔵 Acquired current position 2021-07-23 22:39:05.142 26355-26845/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] Median accuracy: 5.0 2021-07-23 22:39:05.159 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 22:39:05.172 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed 2021-07-23 22:39:05.218 26355-26824/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.l.TSLocationManager onSingleLocationResult] 🔵 Acquired current position 2021-07-23 22:39:05.219 26355-26824/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] Median accuracy: 5.0 2021-07-23 22:39:05.238 26355-26845/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.s.LocationRequestService b] SingleLocationRequest 1 isFinished? true 2021-07-23 22:39:05.243 26355-26845/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 22:39:05.243 26355-26824/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.s.LocationRequestService b] SingleLocationRequest 2 isFinished? true 2021-07-23 22:39:05.245 26355-26824/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 22:39:05.260 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 22:39:05.275 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed 2021-07-23 22:39:14.518 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 22:39:14.523 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 22:39:14.529 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 22:39:21.595 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ getCurrentPosition() 2021-07-23 22:39:21.606 26355-26844/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c f] 🔵 LocationAuthorization: Requesting permission 2021-07-23 22:39:21.610 26355-26355/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c$i onPermissionGranted] ✅ LocationAuthorization: Permission granted 2021-07-23 22:39:21.831 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 22:39:21.839 26355-26856/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService a] ℹ️ Location availability: true 2021-07-23 22:39:21.841 26355-26856/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 22:39:22.106 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed 2021-07-23 22:39:24.353 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ getGeofences() 2021-07-23 22:39:24.416 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 22:39:24.452 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ removeGeofences() 2021-07-23 22:39:24.463 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ addGeofences() 2021-07-23 22:39:24.477 26355-26861/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.data.sqlite.GeofenceDAO destroyAll] ✅
2021-07-23 22:39:24.493 26355-26862/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.data.sqlite.GeofenceDAO create] ✅ SL100100727_P_1_PRE_ARRIVAL 2021-07-23 22:39:24.543 26355-26862/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.data.sqlite.GeofenceDAO create] ✅ SL100100727_P_1_ARRIVAL 2021-07-23 22:39:24.594 26355-26862/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager c] ℹ️ Persist monitored geofences: [] 2021-07-23 22:39:24.847 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager$e run] evaluation buffer timer elapsed 2021-07-23 22:39:25.893 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ getGeofences() 2021-07-23 22:39:26.358 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ setConfig() 2021-07-23 22:39:26.386 26355-26608/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.adapter.TSConfig d] ℹ️ Persist config, dirty: [extras, headers] 2021-07-23 22:39:26.425 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 22:39:26.448 26355-26824/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService b] ╔═════════════════════════════════════════════ ║ getCurrentPosition LocationResult: 3 ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 37.336973,-121.978238 hAcc=5 et=+11h44m11s429ms alt=0.0 vel=0.0 bear=0.0 vAcc=1 sAcc=1 bAcc=30 {Bundle[mParcelledData.dataSize=52]}], age: 295ms, time: 1627060166092 2021-07-23 22:39:26.460 26355-26824/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.l.TSLocationManager onSingleLocationResult] 🔵 Acquired current position 2021-07-23 22:39:26.461 26355-26824/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] Median accuracy: 5.0 2021-07-23 22:39:26.471 26355-26355/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 2021-07-23 22:39:26.490 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ start() 2021-07-23 22:39:26.505 26355-26608/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c e] 🔵 LocationAuthorization: Requesting Background permission 2021-07-23 22:39:26.518 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 22:39:26.520 26355-26608/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c d] 🔵 Should show backgroundPermissionRationale? true 2021-07-23 22:39:26.528 26355-26824/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.s.LocationRequestService b] SingleLocationRequest 3 isFinished? true 2021-07-23 22:39:26.531 26355-26824/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 22:39:26.597 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed 2021-07-23 22:39:26.752 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity execute] android.permission.ACCESS_BACKGROUND_LOCATION 2021-07-23 22:39:27.314 26355-26608/com.schneider.fp.carriers D/TSLocationManager: $ getGeofences() 2021-07-23 22:39:31.360 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity stop] eventCount: 0 2021-07-23 22:39:31.595 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity onDestroy] 2021-07-23 22:39:36.526 26355-26825/com.schneider.fp.carriers I/TSLocationManager: - Enable: false → true, trackingMode: 1 2021-07-23 22:39:36.566 26355-26825/com.schneider.fp.carriers W/TSLocationManager: [c.t.l.s.ActivityRecognitionService b] ⚠️ Cannot start motion-activity updates: permission is denied 2021-07-23 22:39:36.584 26355-26825/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.http.HttpService startMonitoringConnectivityChanges] 🎾 Start monitoring connectivity changes 2021-07-23 22:39:36.615 26355-26825/com.schneider.fp.carriers D/TSLocationManager: [c.t.locationmanager.device.a c] 🎾 Start monitoring powersave changes 2021-07-23 22:39:36.622 26355-26890/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.http.HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? true ╠═════════════════════════════════════════════ 2021-07-23 22:39:36.624 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity execute] locationsettings 2021-07-23 22:39:36.625 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.adapter.TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): 10 2021-07-23 22:39:36.707 26355-26825/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.service.HeartbeatService c] 🔴 Stop heartbeat 2021-07-23 22:39:36.735 26355-26825/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c f] 🔵 LocationAuthorization: Requesting permission 2021-07-23 22:39:36.741 26355-26825/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.service.TrackingService a] 🔵 setPace: false → false 2021-07-23 22:39:36.886 26355-26355/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c$i onPermissionGranted] ✅ LocationAuthorization: Permission granted 2021-07-23 22:39:37.291 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity stop] eventCount: 0 2021-07-23 22:39:37.368 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 22:39:37.370 26355-26827/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService a] ℹ️ Location availability: true 2021-07-23 22:39:37.370 26355-26827/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 22:39:37.512 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity onDestroy] 2021-07-23 22:39:37.628 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed 2021-07-23 22:39:37.631 26355-26856/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 2021-07-23 22:39:37.752 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 ActivityRecognitionService [eventCount: 1] 2021-07-23 22:39:37.764 26355-26845/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.s.ActivityRecognitionService a] 🚘 ️DetectedActivity [type=STILL, confidence=100] 2021-07-23 22:39:37.773 26355-26845/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish ActivityRecognitionService [eventCount: 0, sticky: false] 2021-07-23 22:39:38.809 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 ActivityRecognitionService destroyed 2021-07-23 22:39:41.179 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 22:39:41.181 26355-26856/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService b] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 4 ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 37.336973,-121.978238 hAcc=5 et=+11h44m26s408ms alt=0.0 vel=0.0 bear=90.0 vAcc=1 sAcc=1 bAcc=30 {Bundle[mParcelledData.dataSize=52]}], age: 67ms, time: 1627060181109 2021-07-23 22:39:41.185 26355-26856/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.l.TSLocationManager onSingleLocationResult] 🔵 Acquired motionchange position, isMoving: false 2021-07-23 22:39:41.186 26355-26856/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] Median accuracy: 5.0 2021-07-23 22:39:41.194 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 22:39:41.202 26355-26856/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.s.LocationRequestService b] SingleLocationRequest 4 isFinished? true 2021-07-23 22:39:41.203 26355-26856/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 22:39:41.204 26355-26844/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.data.sqlite.b persist] ✅ INSERT: ab1bd08c-c7d3-4ed0-80cf-916527ec1dc3 2021-07-23 22:39:41.212 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed 2021-07-23 22:39:41.227 26355-26355/com.schneider.fp.carriers W/TSLocationManager: [c.t.l.s.ActivityRecognitionService b] ⚠️ Cannot start motion-activity updates: permission is denied 2021-07-23 22:39:41.228 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager startMonitoringStationaryRegion] 🎾 Start monitoring stationary region (radius: 150.0m 37.3369733,-121.9782383 hAcc=5.0) 2021-07-23 22:39:41.234 26355-26844/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 1) ╠═════════════════════════════════════════════ 2021-07-23 22:39:41.263 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 TrackingService [eventCount: 1] 2021-07-23 22:39:41.263 26355-26355/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.service.TrackingService h] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: false ╠═════════════════════════════════════════════ 2021-07-23 22:39:41.264 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish TrackingService [eventCount: 0, sticky: false] 2021-07-23 22:39:41.286 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 BackgroundTaskService [eventCount: 1] 2021-07-23 22:39:41.287 26355-26355/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.u.BackgroundTaskManager onStartJob] ⏳ startBackgroundTask: 1 2021-07-23 22:39:41.289 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager$f$a a] ℹ️ GeofencingClient addGeofences 2021-07-23 22:39:41.290 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager c] ℹ️ Persist monitored geofences: [SL100100727_P_1_PRE_ARRIVAL, SL100100727_P_1_ARRIVAL] 2021-07-23 22:39:41.291 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager$f$a a] ╔═════════════════════════════════════════════ ║ TSGeofenceManager monitoring 2/2 ╠═════════════════════════════════════════════ ╟─ 🎾 SL100100727_P_1_PRE_ARRIVAL ╟─ 🎾 SL100100727_P_1_ARRIVAL ╚═════════════════════════════════════════════ 2021-07-23 22:39:41.318 26355-26901/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.data.sqlite.b first] ✅ Locked 1 records 2021-07-23 22:39:41.319 26355-26901/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService a] 🔵 HTTP POST: ab1bd08c-c7d3-4ed0-80cf-916527ec1dc3 2021-07-23 22:39:41.517 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 TrackingService destroyed 2021-07-23 22:39:41.915 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 ActivityRecognitionService [eventCount: 1] 2021-07-23 22:39:41.916 26355-26902/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.s.ActivityRecognitionService a] 🚘 ️DetectedActivity [type=STILL, confidence=100] 2021-07-23 22:39:41.919 26355-26902/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish ActivityRecognitionService [eventCount: 0, sticky: false] 2021-07-23 22:39:42.926 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 ActivityRecognitionService destroyed 2021-07-23 22:39:44.979 26355-26903/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService$i onResponse] 🔵 Response: 200 2021-07-23 22:39:44.984 26355-26903/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.data.sqlite.b destroy] ✅ DESTROY: ab1bd08c-c7d3-4ed0-80cf-916527ec1dc3 2021-07-23 22:39:45.002 26355-26903/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.u.BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 1 2021-07-23 22:39:45.003 26355-26903/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish BackgroundTaskService [eventCount: 0, sticky: false] 2021-07-23 22:39:45.011 26355-26355/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 BackgroundTaskService destroyed

christocracy commented 2 years ago

Are you running this on an emulator or real device?

G93692 commented 2 years ago

I am using an emulator

christocracy commented 2 years ago

Try on real device.

G93692 commented 2 years ago

Please logcat log (taken from Real Android 11 device)

2021-07-23 23:05:25.265 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ addLocationListener() 2021-07-23 23:05:25.270 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ addMotionChangeListener() 2021-07-23 23:05:25.273 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ addActivityChangeListener() 2021-07-23 23:05:25.275 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ addProviderChangeListener() 2021-07-23 23:05:25.277 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ addScheduleListener() 2021-07-23 23:05:25.281 28226-28773/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ℹ️ Persist config, dirty: [] 2021-07-23 23:05:25.281 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ addHttpListener() 2021-07-23 23:05:25.281 28226-28773/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ℹ️ Persist config, dirty: [headlessJobService] 2021-07-23 23:05:25.282 28226-28773/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ✅ Google Play Services: connected (version code:12451000) 2021-07-23 23:05:25.282 28226-28773/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 🎾 Start monitoring location-provider changes 2021-07-23 23:05:25.283 28226-28773/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] CREATE TABLE IF NOT EXISTS locations (id INTEGER PRIMARY KEY AUTOINCREMENT, uuid TEXT NOT NULL DEFAULT '', timestamp TEXT, json TEXT, data BLOB, encrypted BOOLEAN NOT NULL DEFAULT 0, locked BOOLEAN NOT NULL DEFAULT 0); 2021-07-23 23:05:25.283 28226-28773/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] CREATE TABLE IF NOT EXISTS geofences (id INTEGER PRIMARY KEY AUTOINCREMENT, identifier TEXT NOT NULL UNIQUE, latitude DOUBLE NOT NULL, sin_latitude DOUBLE NOT NULL, cos_latitude DOUBLE NOT NULL, longitude DOUBLE NOT NULL, sin_longitude DOUBLE NOT NULL, cos_longitude DOUBLE NOT NULL, radius DOUBLE NOT NULL, notifyOnEntry BOOLEAN NOT NULL DEFAULT 0, notifyOnExit BOOLEAN NOT NULL DEFAULT 0, notifyOnDwell BOOLEAN NOT NULL DEFAULT 0, loiteringDelay INTEGER NOT NULL DEFAULT 0, extras TEXT); 2021-07-23 23:05:25.284 28226-28773/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ℹ️ PRUNE -1 days 2021-07-23 23:05:25.285 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ addGeofenceListener() 2021-07-23 23:05:25.290 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ ready() 2021-07-23 23:05:25.294 28226-28700/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.adapter.TSConfig d] ℹ️ Persist config, dirty: [allowIdenticalLocations, backgroundPermissionRationale, backgroundPermissionRationale.title, backgroundPermissionRationale.message, backgroundPermissionRationale.negativeAction, desiredAccuracy, disableElasticity, distanceFilter, extras, headers, logLevel, startOnBoot, stopOnTerminate, url] 2021-07-23 23:05:25.317 28226-28226/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 2021-07-23 23:05:25.394 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ setConfig() 2021-07-23 23:05:25.395 28226-28700/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.adapter.TSConfig d] ℹ️ Persist config, dirty: [headers] 2021-07-23 23:05:25.408 28226-28226/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 2021-07-23 23:07:45.328 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 23:07:45.333 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 23:07:45.337 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 23:07:53.597 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ getCurrentPosition() 2021-07-23 23:07:53.603 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ getCurrentPosition() 2021-07-23 23:07:53.612 28226-29992/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c f] 🔵 LocationAuthorization: Requesting permission 2021-07-23 23:07:53.613 28226-29993/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c f] 🔵 LocationAuthorization: Requesting permission 2021-07-23 23:07:55.876 28226-28226/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c$i onPermissionGranted] ✅ LocationAuthorization: Permission granted 2021-07-23 23:08:05.867 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 23:08:05.871 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 23:08:05.875 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 23:08:16.841 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ getCurrentPosition() 2021-07-23 23:08:16.843 28226-29995/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c f] 🔵 LocationAuthorization: Requesting permission 2021-07-23 23:08:16.846 28226-28226/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c$i onPermissionGranted] ✅ LocationAuthorization: Permission granted 2021-07-23 23:08:18.385 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ getGeofences() 2021-07-23 23:08:18.438 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ getState() 2021-07-23 23:08:18.462 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ removeGeofences() 2021-07-23 23:08:18.467 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ addGeofences() 2021-07-23 23:08:18.488 28226-30074/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.data.sqlite.GeofenceDAO destroyAll] ✅
2021-07-23 23:08:18.499 28226-30075/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.data.sqlite.GeofenceDAO create] ✅ SL100100727_P_1_PRE_ARRIVAL 2021-07-23 23:08:18.503 28226-30075/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.data.sqlite.GeofenceDAO create] ✅ SL100100727_P_1_ARRIVAL 2021-07-23 23:08:18.513 28226-30075/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager c] ℹ️ Persist monitored geofences: [] 2021-07-23 23:08:18.765 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager$e run] evaluation buffer timer elapsed 2021-07-23 23:08:18.783 28226-29994/com.schneider.fp.carriers E/TSLocationManager: [c.t.l.l.TSLocationManager getLastLocation] ‼️ Failed to get last location: com.google.android.gms.tasks.zzu@f67d3ea 2021-07-23 23:08:25.034 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ getGeofences() 2021-07-23 23:08:25.262 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ setConfig() 2021-07-23 23:08:25.266 28226-28700/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.adapter.TSConfig d] ℹ️ Persist config, dirty: [extras, headers] 2021-07-23 23:08:25.270 28226-28226/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 2021-07-23 23:08:25.290 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ start() 2021-07-23 23:08:25.291 28226-28700/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c e] 🔵 LocationAuthorization: Requesting Background permission 2021-07-23 23:08:25.298 28226-28700/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c d] 🔵 Should show backgroundPermissionRationale? true 2021-07-23 23:08:25.360 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity execute] android.permission.ACCESS_BACKGROUND_LOCATION 2021-07-23 23:08:26.205 28226-28700/com.schneider.fp.carriers D/TSLocationManager: $ getGeofences() 2021-07-23 23:08:27.351 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity stop] eventCount: 0 2021-07-23 23:08:27.458 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity onDestroy] 2021-07-23 23:08:31.656 28226-29993/com.schneider.fp.carriers I/TSLocationManager: - Enable: false → true, trackingMode: 1 2021-07-23 23:08:31.708 28226-29993/com.schneider.fp.carriers W/TSLocationManager: [c.t.l.s.ActivityRecognitionService b] ⚠️ Cannot start motion-activity updates: permission is denied 2021-07-23 23:08:31.724 28226-29993/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.http.HttpService startMonitoringConnectivityChanges] 🎾 Start monitoring connectivity changes 2021-07-23 23:08:31.741 28226-29993/com.schneider.fp.carriers D/TSLocationManager: [c.t.locationmanager.device.a c] 🎾 Start monitoring powersave changes 2021-07-23 23:08:31.750 28226-30121/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.http.HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? true ╠═════════════════════════════════════════════ 2021-07-23 23:08:31.760 28226-29993/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.service.HeartbeatService c] 🔴 Stop heartbeat 2021-07-23 23:08:31.765 28226-29993/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c f] 🔵 LocationAuthorization: Requesting permission 2021-07-23 23:08:31.765 28226-29993/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.service.TrackingService a] 🔵 setPace: false → false 2021-07-23 23:08:31.779 28226-28226/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c$i onPermissionGranted] ✅ LocationAuthorization: Permission granted 2021-07-23 23:08:31.781 28226-28226/com.schneider.fp.carriers W/TSLocationManager: [c.t.l.s.ActivityRecognitionService b] ⚠️ Cannot start motion-activity updates: permission is denied 2021-07-23 23:08:31.797 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity execute] locationsettings 2021-07-23 23:08:31.798 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.adapter.TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): 10 2021-07-23 23:08:31.884 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity$a onComplete] ℹ️ Location Settings Resolution: START 2021-07-23 23:08:32.753 28226-29992/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 2021-07-23 23:08:35.038 28226-28226/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c f] 🔵 LocationAuthorization: Requesting permission 2021-07-23 23:08:35.048 28226-28226/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.service.HeartbeatService c] 🔴 Stop heartbeat 2021-07-23 23:08:35.050 28226-28226/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c f] 🔵 LocationAuthorization: Requesting permission 2021-07-23 23:08:35.052 28226-28226/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.service.TrackingService a] 🔵 setPace: false → false 2021-07-23 23:08:35.087 28226-28226/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.a.BackgroundGeolocation$y0 onReceive] ╔═════════════════════════════════════════════ ║ Location-provider change: true ╠═════════════════════════════════════════════ ╟─ GPS: true ╟─ Network: true 2021-07-23 23:08:35.099 28226-28226/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c$i onPermissionGranted] ✅ LocationAuthorization: Permission granted 2021-07-23 23:08:35.119 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity onActivityResult] ✅ Location settings resolution: ACCEPTED 2021-07-23 23:08:35.120 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity stop] eventCount: 0 2021-07-23 23:08:35.155 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity execute] locationsettings 2021-07-23 23:08:35.155 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.adapter.TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): 10 2021-07-23 23:08:35.232 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity onDestroy] 2021-07-23 23:08:35.239 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity$a onComplete] ℹ️ Location Settings Resolution: START 2021-07-23 23:08:37.116 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 23:08:37.122 28226-29992/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService a] ℹ️ Location availability: true 2021-07-23 23:08:37.123 28226-29992/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 23:08:37.124 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 23:08:37.127 28226-29992/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService a] ℹ️ Location availability: true 2021-07-23 23:08:37.127 28226-29992/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 23:08:37.381 28226-28226/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed

christocracy commented 2 years ago

Where are you executing getCurrentPosition?

You're not supposed to do that until .ready() resolves.

The plugin is not "ready" to use until .ready() resolves.

G93692 commented 2 years ago

I did some code change. After resolving .ready(), BackgroundGeolocation.getCurrentPosition() is called. But still I am not getting physical activity user permission popup.

Please find the Real device logcat logs:

2021-07-23 23:38:36.579 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 23:38:36.587 8050-8494/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService b] ╔═════════════════════════════════════════════ ║ getCurrentPosition LocationResult: 3 ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 22.667855,88.388112 hAcc=700 et=+3m56s943ms vel=0.0 bear=90.0 vAcc=??? sAcc=??? bAcc=??? {Bundle[{}]}], age: 981ms, time: 1627063715605 2021-07-23 23:38:36.588 8050-8494/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] Median accuracy: 699.999 2021-07-23 23:38:36.593 8050-8494/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.s.LocationRequestService b] SingleLocationRequest 3 isFinished? false 2021-07-23 23:38:36.593 8050-8494/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: true] 2021-07-23 23:38:40.470 8050-8410/com.schneider.fp.carriers D/TSLocationManager: $ getGeofences() 2021-07-23 23:38:40.663 8050-8410/com.schneider.fp.carriers D/TSLocationManager: $ setConfig() 2021-07-23 23:38:40.667 8050-8410/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.adapter.TSConfig d] ℹ️ Persist config, dirty: [extras, headers] 2021-07-23 23:38:40.671 8050-8050/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 2021-07-23 23:38:40.684 8050-8410/com.schneider.fp.carriers D/TSLocationManager: $ start() 2021-07-23 23:38:40.685 8050-8410/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c e] 🔵 LocationAuthorization: Requesting Background permission 2021-07-23 23:38:40.687 8050-8410/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c d] 🔵 Should show backgroundPermissionRationale? true 2021-07-23 23:38:40.806 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity execute] android.permission.ACCESS_BACKGROUND_LOCATION 2021-07-23 23:38:41.553 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 23:38:41.557 8050-20218/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService b] ╔═════════════════════════════════════════════ ║ getCurrentPosition LocationResult: 3 ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 22.667855,88.388112 hAcc=700 et=+4m1s955ms vel=0.0 bear=90.0 vAcc=??? sAcc=??? bAcc=??? {Bundle[{}]}], age: 939ms, time: 1627063720617 2021-07-23 23:38:41.557 8050-20218/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] Median accuracy: 699.999 2021-07-23 23:38:41.565 8050-20218/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.s.LocationRequestService b] SingleLocationRequest 3 isFinished? false 2021-07-23 23:38:41.565 8050-20218/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: true] 2021-07-23 23:38:44.597 8050-8410/com.schneider.fp.carriers D/TSLocationManager: $ getGeofences() 2021-07-23 23:38:46.045 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity stop] eventCount: 0 2021-07-23 23:38:46.201 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity onDestroy] 2021-07-23 23:38:46.579 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 23:38:46.583 8050-20221/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService b] ╔═════════════════════════════════════════════ ║ getCurrentPosition LocationResult: 3 ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 22.667855,88.388112 hAcc=700 et=+4m6s963ms vel=0.0 bear=90.0 vAcc=??? sAcc=??? bAcc=??? {Bundle[{}]}], age: 957ms, time: 1627063725625 2021-07-23 23:38:46.585 8050-20221/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.l.TSLocationManager onSingleLocationResult] 🔵 Acquired current position 2021-07-23 23:38:46.594 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 23:38:46.595 8050-20221/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.s.LocationRequestService b] SingleLocationRequest 3 isFinished? true 2021-07-23 23:38:46.596 8050-20221/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 23:38:46.608 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed 2021-07-23 23:38:52.271 8050-8050/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c$i onPermissionGranted] ✅ LocationAuthorization: Permission granted 2021-07-23 23:38:52.277 8050-20218/com.schneider.fp.carriers I/TSLocationManager: - Enable: false → true, trackingMode: 1 2021-07-23 23:38:52.304 8050-20218/com.schneider.fp.carriers W/TSLocationManager: [c.t.l.s.ActivityRecognitionService b] ⚠️ Cannot start motion-activity updates: permission is denied 2021-07-23 23:38:52.317 8050-20218/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.http.HttpService startMonitoringConnectivityChanges] 🎾 Start monitoring connectivity changes 2021-07-23 23:38:52.346 8050-20218/com.schneider.fp.carriers D/TSLocationManager: [c.t.locationmanager.device.a c] 🎾 Start monitoring powersave changes 2021-07-23 23:38:52.349 8050-21742/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.http.HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? true ╠═════════════════════════════════════════════ 2021-07-23 23:38:52.382 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity execute] locationsettings 2021-07-23 23:38:52.382 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.adapter.TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): 10 2021-07-23 23:38:52.384 8050-20218/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.service.HeartbeatService c] 🔴 Stop heartbeat 2021-07-23 23:38:52.398 8050-20218/com.schneider.fp.carriers D/TSLocationManager: [c.t.locationmanager.util.c f] ℹ️ LocationAuthorization: Permission granted 2021-07-23 23:38:52.400 8050-20218/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.service.TrackingService a] 🔵 setPace: false → false 2021-07-23 23:38:52.547 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity stop] eventCount: 0 2021-07-23 23:38:52.656 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 23:38:52.657 8050-20220/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService a] ℹ️ Location availability: true 2021-07-23 23:38:52.658 8050-20220/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 23:38:52.730 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity onDestroy] 2021-07-23 23:38:52.914 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed 2021-07-23 23:38:53.354 8050-8494/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 0) ╠═════════════════════════════════════════════ 2021-07-23 23:39:09.160 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-23 23:39:09.165 8050-8494/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService b] ╔═════════════════════════════════════════════ ║ motionchange LocationResult: 4 ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 22.668200,88.385383 hAcc=100 et=+4m29s492ms vAcc=??? sAcc=??? bAcc=??? {Bundle[{}]}], age: 1008ms, time: 1627063748154 2021-07-23 23:39:09.170 8050-8494/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.l.TSLocationManager onSingleLocationResult] 🔵 Acquired motionchange position, isMoving: false 2021-07-23 23:39:09.178 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 23:39:09.189 8050-8494/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] Median accuracy: 699.999 2021-07-23 23:39:09.205 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed 2021-07-23 23:39:09.219 8050-8494/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.s.LocationRequestService b] SingleLocationRequest 4 isFinished? true 2021-07-23 23:39:09.220 8050-8494/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-23 23:39:09.222 8050-8050/com.schneider.fp.carriers W/TSLocationManager: [c.t.l.s.ActivityRecognitionService b] ⚠️ Cannot start motion-activity updates: permission is denied 2021-07-23 23:39:09.223 8050-16108/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.data.sqlite.b persist] ✅ INSERT: 0ab97e69-a811-4039-8ecf-88a806b88591 2021-07-23 23:39:09.230 8050-16108/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService flush] ╔═════════════════════════════════════════════ ║ HTTP Service (count: 1) ╠═════════════════════════════════════════════ 2021-07-23 23:39:09.234 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager startMonitoringStationaryRegion] 🎾 Start monitoring stationary region (radius: 150.0m 22.6681996,88.3853831 hAcc=100.0) 2021-07-23 23:39:09.262 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 BackgroundTaskService [eventCount: 1] 2021-07-23 23:39:09.263 8050-8050/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.u.BackgroundTaskManager onStartJob] ⏳ startBackgroundTask: 1 2021-07-23 23:39:09.292 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 TrackingService [eventCount: 1] 2021-07-23 23:39:09.293 8050-8050/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.service.TrackingService h] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: false ╠═════════════════════════════════════════════ 2021-07-23 23:39:09.293 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish TrackingService [eventCount: 0, sticky: false] 2021-07-23 23:39:09.300 8050-16108/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.data.sqlite.b first] ✅ Locked 1 records 2021-07-23 23:39:09.300 8050-16108/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService a] 🔵 HTTP POST: 0ab97e69-a811-4039-8ecf-88a806b88591 2021-07-23 23:39:09.306 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager$f$a a] ℹ️ GeofencingClient addGeofences 2021-07-23 23:39:09.308 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager c] ℹ️ Persist monitored geofences: [127460256_PRE_ARRIVAL, 127460256_ARRIVAL] 2021-07-23 23:39:09.310 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager$f$a a] ╔═════════════════════════════════════════════ ║ TSGeofenceManager monitoring 2/2 ╠═════════════════════════════════════════════ ╟─ 🎾 127460256_PRE_ARRIVAL ╟─ 🎾 127460256_ARRIVAL ╚═════════════════════════════════════════════ 2021-07-23 23:39:09.546 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 TrackingService destroyed 2021-07-23 23:39:11.662 8050-21991/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.http.HttpService$i onResponse] 🔵 Response: 200 2021-07-23 23:39:11.669 8050-21991/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.data.sqlite.b destroy] ✅ DESTROY: 0ab97e69-a811-4039-8ecf-88a806b88591 2021-07-23 23:39:11.681 8050-21991/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.u.BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 1 2021-07-23 23:39:11.682 8050-21991/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish BackgroundTaskService [eventCount: 0, sticky: false] 2021-07-23 23:39:11.685 8050-8050/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 BackgroundTaskService destroyed 2021-07-23 23:39:52.457 8050-8050/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.TSScheduleManager oneShot] ⏰ Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)

christocracy commented 2 years ago

Show me all your code. You're doing something wrong.

G93692 commented 2 years ago

Would you please share me your email ID? I can share the code snippet.

christocracy commented 2 years ago

info@transistorsoft.com

G93692 commented 2 years ago

Chris - I have sent an email to info@transistorsoft.com, Please check. If you wish we can connect in Webex.

christocracy commented 2 years ago

Your code is a mess. .ready() is to be called once and only once. Not twice.

christocracy commented 2 years ago

I suggest you first experiment with the plugin in a fresh new Hello World app, in isolation of your application code.

G93692 commented 2 years ago

yes Chris, .ready() is called once at the time of App initialisation. For this reason initiateGPSconfig() has the .ready() and initiateGPSconfig() is called in Index.ts.

After that as per the need basis we called following function in individual pages.
BackgroundGeolocation.getCurrentPosition() BackgroundGeolocation.start()

I have shared the modified code, please check.

christocracy commented 2 years ago

Test a simple Hello World app first.

G93692 commented 2 years ago

Hi Chris, In my Hello World app also I am not getting physical activity user permission, if I select "Allow only while using the app" from the user permission popup.

I have sent the sample code to email: info@transistorsoft.com, Kindly check and let me how to resolve this issue.

Thanks!

G93692 commented 2 years ago

Please find the logcal debug log, Taken from a real Android11 device.

2021-07-24 02:18:34.897 14044-14385/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ℹ️ Persist config, dirty: [] 2021-07-24 02:18:34.898 14044-14379/com.schneider.fp.carriers D/TSLocationManager: $ ready() 2021-07-24 02:18:34.898 14044-14385/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ℹ️ Persist config, dirty: [headlessJobService] 2021-07-24 02:18:34.898 14044-14385/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ✅ Google Play Services: connected (version code:12451000) 2021-07-24 02:18:34.899 14044-14385/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 🎾 Start monitoring location-provider changes 2021-07-24 02:18:34.901 14044-14379/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.adapter.TSConfig d] ℹ️ Persist config, dirty: [allowIdenticalLocations, debug, desiredAccuracy, disableElasticity, distanceFilter, logLevel, startOnBoot, stopOnTerminate] 2021-07-24 02:18:34.918 14044-14398/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.data.sqlite.a onCreate] CREATE TABLE IF NOT EXISTS locations (id INTEGER PRIMARY KEY AUTOINCREMENT, uuid TEXT NOT NULL DEFAULT '', timestamp TEXT, json TEXT, data BLOB, encrypted BOOLEAN NOT NULL DEFAULT 0, locked BOOLEAN NOT NULL DEFAULT 0); 2021-07-24 02:18:34.919 14044-14398/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.data.sqlite.a onCreate] CREATE TABLE IF NOT EXISTS geofences (id INTEGER PRIMARY KEY AUTOINCREMENT, identifier TEXT NOT NULL UNIQUE, latitude DOUBLE NOT NULL, sin_latitude DOUBLE NOT NULL, cos_latitude DOUBLE NOT NULL, longitude DOUBLE NOT NULL, sin_longitude DOUBLE NOT NULL, cos_longitude DOUBLE NOT NULL, radius DOUBLE NOT NULL, notifyOnEntry BOOLEAN NOT NULL DEFAULT 0, notifyOnExit BOOLEAN NOT NULL DEFAULT 0, notifyOnDwell BOOLEAN NOT NULL DEFAULT 0, loiteringDelay INTEGER NOT NULL DEFAULT 0, extras TEXT); 2021-07-24 02:18:34.932 14044-14398/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.data.sqlite.b prune] ℹ️ PRUNE -1 days 2021-07-24 02:18:38.940 14044-14379/com.schneider.fp.carriers D/TSLocationManager: $ getCurrentPosition() 2021-07-24 02:18:38.950 14044-14403/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c f] 🔵 LocationAuthorization: Requesting permission 2021-07-24 02:18:40.493 14044-14044/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c$i onPermissionGranted] ✅ LocationAuthorization: Permission granted 2021-07-24 02:18:40.704 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-24 02:18:40.708 14044-14403/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService a] ℹ️ Location availability: true 2021-07-24 02:18:40.709 14044-14403/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-24 02:18:40.965 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed 2021-07-24 02:18:41.740 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-24 02:18:41.749 14044-14406/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService b] ╔═════════════════════════════════════════════ ║ getCurrentPosition LocationResult: 1 ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 22.668200,88.385383 hAcc=100 et=+2h44m2s26ms vAcc=??? sAcc=??? bAcc=??? {Bundle[{}]}], age: 1056ms, time: 1627073320687 2021-07-24 02:18:41.987 14044-14406/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] Median accuracy: 100.0 2021-07-24 02:18:42.021 14044-14406/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.s.LocationRequestService b] SingleLocationRequest 1 isFinished? false 2021-07-24 02:18:42.022 14044-14406/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: true] 2021-07-24 02:18:45.530 14044-14379/com.schneider.fp.carriers D/TSLocationManager: $ setConfig() 2021-07-24 02:18:45.550 14044-14379/com.schneider.fp.carriers D/TSLocationManager: $ start() 2021-07-24 02:18:45.555 14044-14379/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c e] 🔵 LocationAuthorization: Requesting Background permission 2021-07-24 02:18:45.562 14044-14379/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c d] 🔵 Should show backgroundPermissionRationale? true 2021-07-24 02:18:45.606 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity execute] android.permission.ACCESS_BACKGROUND_LOCATION 2021-07-24 02:18:46.605 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-24 02:18:46.610 14044-14407/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService b] ╔═════════════════════════════════════════════ ║ getCurrentPosition LocationResult: 1 ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 22.668202,88.385631 hAcc=100 et=+2h44m7s19ms vel=0.071218155 bear=89.38586 vAcc=??? sAcc=??? bAcc=??? {Bundle[{}]}], age: 927ms, time: 1627073325681 2021-07-24 02:18:46.632 14044-14407/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] Median accuracy: 100.0 2021-07-24 02:18:46.637 14044-14407/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.s.LocationRequestService b] SingleLocationRequest 1 isFinished? false 2021-07-24 02:18:46.638 14044-14407/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: true] 2021-07-24 02:18:47.571 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity stop] eventCount: 0 2021-07-24 02:18:47.630 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity onDestroy] 2021-07-24 02:18:50.831 14044-14044/com.schneider.fp.carriers I/TSLocationManager: [c.t.locationmanager.util.c$i onPermissionGranted] ✅ LocationAuthorization: Permission granted 2021-07-24 02:18:50.834 14044-14398/com.schneider.fp.carriers I/TSLocationManager: - Enable: false → true, trackingMode: 1 2021-07-24 02:18:50.852 14044-14398/com.schneider.fp.carriers W/TSLocationManager: [c.t.l.s.ActivityRecognitionService b] ⚠️ Cannot start motion-activity updates: permission is denied 2021-07-24 02:18:50.869 14044-14398/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.http.HttpService startMonitoringConnectivityChanges] 🎾 Start monitoring connectivity changes 2021-07-24 02:18:50.880 14044-14398/com.schneider.fp.carriers D/TSLocationManager: [c.t.locationmanager.device.a c] 🎾 Start monitoring powersave changes 2021-07-24 02:18:50.882 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity execute] locationsettings 2021-07-24 02:18:50.883 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.adapter.TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): 10 2021-07-24 02:18:50.886 14044-14398/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.service.HeartbeatService c] 🔴 Stop heartbeat 2021-07-24 02:18:50.889 14044-14398/com.schneider.fp.carriers D/TSLocationManager: [c.t.locationmanager.util.c f] ℹ️ LocationAuthorization: Permission granted 2021-07-24 02:18:50.890 14044-14398/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.service.TrackingService a] 🔵 setPace: false → false 2021-07-24 02:18:50.890 14044-14701/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.http.HttpService a] ╔═════════════════════════════════════════════ ║ 📶 Connectivity change: connected? true ╠═════════════════════════════════════════════ 2021-07-24 02:18:50.950 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity stop] eventCount: 0 2021-07-24 02:18:51.034 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-24 02:18:51.036 14044-14402/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService a] ℹ️ Location availability: true 2021-07-24 02:18:51.037 14044-14402/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: true] 2021-07-24 02:18:51.103 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.a.TSLocationManagerActivity onDestroy] 2021-07-24 02:18:51.634 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] 🎾 LocationRequestService [eventCount: 1] 2021-07-24 02:18:51.637 14044-14404/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.LocationRequestService b] ╔═════════════════════════════════════════════ ║ getCurrentPosition LocationResult: 1 ╠═════════════════════════════════════════════ ╟─ 📍 Location[fused 22.668202,88.385618 hAcc=700 et=+2h44m12s359ms vel=0.02046414 bear=89.403984 vAcc=??? sAcc=??? bAcc=??? {Bundle[{}]}], age: 615ms, time: 1627073331020 2021-07-24 02:18:51.645 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-24 02:18:51.647 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed 2021-07-24 02:18:51.670 14044-14404/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.l.TSLocationManager onSingleLocationResult] 🔵 Acquired current position 2021-07-24 02:18:51.680 14044-14404/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.s.LocationRequestService b] SingleLocationRequest 1 isFinished? true 2021-07-24 02:18:51.681 14044-14404/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-24 02:18:56.288 14044-14379/com.schneider.fp.carriers D/TSLocationManager: $ stop() 2021-07-24 02:18:56.294 14044-14379/com.schneider.fp.carriers W/TSLocationManager: [c.t.l.s.ActivityRecognitionService b] ⚠️ Cannot start motion-activity updates: permission is denied 2021-07-24 02:18:56.318 14044-14379/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.l.TSLocationManager clearLastOdometerLocation] ℹ️ Clear last odometer location 2021-07-24 02:18:56.322 14044-14402/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager c] ℹ️ Persist monitored geofences: [] 2021-07-24 02:18:56.323 14044-14379/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.s.ActivityRecognitionService c] 🔴 Stop motion-activity updates 2021-07-24 02:18:56.323 14044-14402/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.g.TSGeofenceManager e] 🔴 Stop monitoring geofences 2021-07-24 02:18:56.324 14044-14379/com.schneider.fp.carriers I/TSLocationManager: [c.t.l.service.HeartbeatService c] 🔴 Stop heartbeat 2021-07-24 02:18:56.325 14044-14379/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.http.HttpService stopMonitoringConnectivityChanges] 🔴 Stop monitoring connectivity changes 2021-07-24 02:18:56.326 14044-14379/com.schneider.fp.carriers D/TSLocationManager: [c.t.locationmanager.device.a d] 🔴 Stop monitoring powersave changes 2021-07-24 02:18:56.336 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] 2021-07-24 02:18:56.369 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 LocationRequestService destroyed 2021-07-24 02:18:56.384 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish TrackingService [eventCount: 0, sticky: false] 2021-07-24 02:18:56.399 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish GeofencingService [eventCount: 0, sticky: false] 2021-07-24 02:18:56.411 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService a] ⚙️︎ finish ActivityRecognitionService [eventCount: 0, sticky: false] 2021-07-24 02:18:56.417 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 TrackingService destroyed 2021-07-24 02:18:56.420 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 GeofencingService destroyed 2021-07-24 02:18:56.421 14044-14044/com.schneider.fp.carriers D/TSLocationManager: [c.t.l.service.AbstractService onDestroy] 🔴 ActivityRecognitionService destroyed

G93692 commented 2 years ago

Hi Chris, In my Hello World app also I am not getting physical activity user permission, if I select "Allow only while using the app" from the user permission popup.

I have sent the sample code to email: info@transistorsoft.com, Kindly check and let me how to resolve this issue.

Thanks!

christocracy commented 2 years ago

Put your HelloWorld app into a public github repo and share that with me.

G93692 commented 2 years ago

Please find the public github repo of HelloWorld app:

https://github.com/ujjwalcts/HelloWorld/tree/main

christocracy commented 2 years ago

Your repo contains only an empty README

G93692 commented 2 years ago

Chris - Would you please check now

christocracy commented 2 years ago

Works fine on all 3 devices I tested upon (Tab 2 - [START BACKGROUNDGEOLOCATION])

christocracy commented 2 years ago

By-the-way, there's a pure Capacitor version of Background Geolocation available now. https://github.com/transistorsoft/capacitor-background-geolocation

You no longer have to use the Cordova version with Capacitor 3 apps.

G93692 commented 2 years ago

Thank you Chris. I would request you to follow the steps to replicate the problem. Steps1: After fresh installation, Please tap on "GET CURRENTPOSITION" in Tab 1. you will get Location permission popup. Please select "Allow only while using the app".

Step: Now goto Tab 2. Tap on "START BACKGROUNDGEOLOCATION", It will be shown the Location permission popup, after tap on it, Location permission Settings will open. But it will never ask for "Physical Activity" user permission. If you check in Setting, "Physical Activity" it set as Deny. This is our issue.

Please find the .mp4 file, it executed the scenario.

https://user-images.githubusercontent.com/58215342/127020869-373a26ce-8c55-459b-8c75-ede856e40452.mp4

christocracy commented 2 years ago

Before you getCurrentPosition, add this:

await BackgroundGeolocation.requestPermission();
G93692 commented 2 years ago

But in this case "Physical Activity" user permission will be shown in Tab 1. we do not need "Physical Activity" user permission for getCurrentPosition. We need "Physical Activity" user permission only for BackgroundGeolocation.start() in Tab 2 screen.

Hence please suggest me how to get only location permission for getCurrentPosition in "Tab 1" on tap on "GET CURRENTPOSITION". And in Tab 2, once user tap on "START BACKGROUNDGEOLOCATION", "Physical Activity" user permission popup will be shown.

Thanks again!

christocracy commented 2 years ago

There is no solution currently, other than requesting Physical Activity before getCurrentPosition.

G93692 commented 2 years ago

Okay Chris, Thank you!

In our app base on the user role, app will decide only few users who can start the BackgroundGeolocation.start(). getCurrentPosition is applicable for all users to find his current location. It may confuse the user that why the app is asking for "Physical Activity" user permission if BackgroundGeolocation.start is not visitable for him.

Hence I would request you, let me know if you have any future plan to customise this "Physical Activity" user permission. If yes, Then it will be more feasible.

Also please confirm that Google Play will not reject our app for this BackgroundGeolocation.requestPermission if BackgroundGeolocation.start will not be applied.

stale[bot] commented 2 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 2 years ago

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