Closed projul closed 1 year ago
should fetch the location of the device
No, it should not. BackgroundFetch has nothing to do with “location”.
this plug-in merely executes a periodic callback function, that you provide.
what you do in your callback function is your responsibility (eg using a “geolocation” plug-in to request the current position.)
com.transistorsoft.tsbackgroundfetch.BGTask.fireHeadlessEvent (BGTask.java:231)
you configured enableHeadless: true
: this is a very advanced config option, requiring the creation of a custom Java class. Did you read the api docs about this option?
Sure thanks for your quick response!
Your Environment
Plugin version: "@transistorsoft/capacitor-background-fetch": "^5.0.0"
Platform: iOS or Android Device OS version: any version
Device manufacturer / model: iOS and Android any device XCode version: Version 14.3 (14E222b)
Capacitor info (npx cap doctor) Latest Dependencies:
@capacitor/cli: 5.0.4 @capacitor/core: 5.0.4 @capacitor/android: 5.0.4 @capacitor/ios: 5.0.4
Installed Dependencies:
@capacitor/cli: 5.0.4 @capacitor/core: 5.0.3 @capacitor/android: 5.0.3 @capacitor/ios: 5.0.4
Plugin Config
Expected Behavior
It should fetch the location of the device and post it on configure URL if the app is still in the same place and doesn’t change the location within 15 minutes in the three scenarios below listed: . foreground . Background . Killed
Actual Behavior
Unfortunately doesn’t work in any of the above three states of the app in Android, however, iOS only works sometimes in two states if the app is in the foreground or background.
Steps to Reproduce
On an Android device put your device in the same place for more than 15 minutes on any state foreground, background, or kill. On an iOS device put your device in the same place for more than 15 minutes in the kill state
Context
We are a construction company and employees go to their sides with the devices so that employers can track them. Once the employees reach the task destination then they spent a few hours there. During those hours location is not updating. So the employer cannot know if the employee is still on the location.
Debug logs
We have also seen this issue on the Play Store crashes.
com.transistorsoft.tsbackgroundfetch.BGTask$Error
Exception com.transistorsoft.tsbackgroundfetch.BGTask$Error: at com.transistorsoft.tsbackgroundfetch.BGTask.fireHeadlessEvent (BGTask.java:231) at com.transistorsoft.tsbackgroundfetch.BGTask.onTimeout (BGTask.java:196) at com.transistorsoft.tsbackgroundfetch.BGTask$1.run (BGTask.java:80) at android.os.Handler.handleCallback (Handler.java:938) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loopOnce (Looper.java:226) at android.os.Looper.loop (Looper.java:313) at android.app.ActivityThread.main (ActivityThread.java:8751) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)