0
votes

I have an app in Ionic Cordova/Angular that needs to send geolocation of the user while she requests help, when the help arrives, the system is updated and the geolocation stop. I'm using the plugin https://github.com/mauron85/cordova-plugin-background-geolocation, this plugin works, it sends the info to the API but when in background it keeps sending the last location, and only syncs again when when the app was in foreground, this happens due to new Android versions that updated the security. I tried to install the variation of this plugin https://github.com/HaylLtd/cordova-background-geolocation-plugin/, but when the system doesn't recognizes the installation, it duplicates info in the AndroidManifest and crashes the app. Some of plugins from Cordova are not updated anymore, how to you guys handle background tasks such as geolocation in this case? The plugin is not updated since 2019

import { BackgroundGeolocation, BackgroundGeolocationConfig, BackgroundGeolocationEvents, BackgroundGeolocationResponse, BackgroundGeolocationMode } from '@awesome-cordova-plugins/background-geolocation/ngx';
  
  config: BackgroundGeolocationConfig = {
    desiredAccuracy: 0,
    stationaryRadius: 10,
    distanceFilter: 30,
    stopOnStillActivity: false,
    interval:5000,
    debug: false, //  enable this hear sounds for background-geolocation life-cycle.
    stopOnTerminate: false, // enable this to clear background location settings when the app terminates,
  };

this.backgroundGeolocation.configure(this.config).then(() => {
        this.backgroundGeolocation.on(BackgroundGeolocationEvents.location).subscribe((location: BackgroundGeolocationResponse) => {
        this.localizacao = location
        });

Thank you in advance

Erikson