Closed 3rikson closed 1 year ago
Hello
I had help of a friend and we solved the issue, my error was regarding the promisse that I was considering as watcher, and not the id of it.
startTracking(){
BackgroundGeolocation.addWatcher({...}
sendDataAPI(location);
)).then(id => {
this.watcherId = id;
});
}
Hope it helps who finds him/herself in the same situation. Best regards guys
Hello guys
I'm having an issue to stop the watcher when a condition is satisfied. I send the location to an API, and when a variable is set in the return of this API, the watcher should be removed, but it is not working for me, it keeps sending the data to the API.
This is what I'm doing as service:
import {BackgroundGeolocationPlugin} from '@capacitor-community/background-geolocation'; const BackgroundGeolocation = registerPlugin('BackgroundGeolocation');
Even the variable coming as expected, the command to stop the watcher doesn't works. I read in previous posts that async may be an issue, but the typescript forces you to insert it to wait the promisse from the API. I tried different approaches, but without success to stop the watcher. Have you guys faced it?
Thank you in advance
Erikson