mauron85/cordova-plugin-background-geolocation

Forground and background issues in API 31-32 Android 12 emulator

pouriamoosavi opened this issue · 1 comments

Your Environment

  • Plugin version: 3.1.0
  • Platform: Android
  • OS version: 12 API 31 and 32
  • Device manufacturer and model: Pixel 3a
  • Running in Simulator: Yes
  • Cordova version (cordova -v): No cordova. Ionic/angular 6, Capacitor 3.3.4
  • Cordova platform version (cordova platform ls):
  • Plugin configuration options: Default configuration or:
desiredAccuracy: 0,
locationProvider: BackgroundGeolocationLocationProvider.RAW_PROVIDER,
stationaryRadius: 50,
distanceFilter: 50,
notificationTitle: 'nn',
notificationText: "" ,
debug: false,
startOnBoot: false,
stopOnTerminate: false,
interval: 10000,
fastestInterval: 5000,
activitiesInterval: 10000,
stopOnStillActivity: false,
startForeground: true,
url: "nn",
httpHeaders: {
  authorization: "nn",
},
postTemplate: {
  lat: '@latitude',
  lng: '@longitude',
  spd: '@speed',
  brn: '@bearing',
  acr: '@accuracy',
  tm: '@time',
}

  • Link to your project: Not public

Context

on("location") and getCurrentLocation don't work. Calling getCurrentLocation with timeout works though. Maybe there is a timeout issue in default location tracking that does not fire. Also in case of adding post url, nothing happened and no request is made. All access have been granted and even the notification is showing.

New updates:

getCurrentLocation works with enableHighAccuracy but it has about 5 seconds delay. Auto update and background still does not work.

Expected Behavior

Work as it works on android 11 and lower.

Actual Behavior

Does nothing. Even getCurrentLocation does not work until specifying timeout

Possible Fix

Maybe there is a timeout in default config that has a problem?

Steps to Reproduce

  1. Install library on Ionic 6 application.
  2. Get access to coarse and fine locations and then background location.
  3. Call start
  4. Nothing happens!
  5. Call getCurrentLocation
  6. Nothing happens!
  7. Call getCurrentLocation({timeout:1000})
  8. Returns location

Context

My application uses background location

Debug logs

Hi, on 05.10.2022 I have seen the same error on the emulator. Some people have clone this repository and seems that they fixed it by using another plugin (f.e. https://github.com/HaylLtd/cordova-background-geolocation-plugin/) as seen in issue #770. But it would be nice if this one actually gets fixed.