transistorsoft/nativescript-background-geolocation-lt

System locked out geolocation

Opened this issue · 1 comments

Your Environment

  • Plugin version: 1.9.1
  • Platform: iOS
  • OS version: 12.1.4
  • Device manufacturer / model: Apple iPhone X
  • Nativescript version (tns info): 5.2.0
  • Plugin config
    nativescript_background_geolocation_lt_1.BackgroundGeolocation.ready({
    reset: true,
    debug: true,
    url: 'URL hidden for security',
    logLevel: nativescript_background_geolocation_lt_1.BackgroundGeolocation.LOG_LEVEL_VERBOSE,
    desiredAccuracy: nativescript_background_geolocation_lt_1.BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
    distanceFilter: 100,
    stopTimeout: 1,
    autoSync: true,
    stopOnTerminate: false,
    startOnBoot: true,
    foregroundService: true,
    preventSuspend: true,
    heartbeatInterval: 60,
    enableHeadless: true
    }, function (state) {
    console.log('[ready] success -', state);
    // _this.paceButtonIcon = (state.isMoving) ? ICONS.pause : ICONS.play;
    _this.enabled = state.enabled;
    }, function (error) {
    console.warn('[ready] FAILURE -', error);
    });
    return _this;
    }
    Object.defineProperty(HelloWorldModel.prototype, "enabled", {
    get: function () {
    return this._enabled;
    },
    set: function (value) {
    console.log('- setEnabled: ', value);
    this.notifyPropertyChange('enabled', value);
    this._enabled = value;
    if (value) {
    nativescript_background_geolocation_lt_1.BackgroundGeolocation.start();
    }
    else {
    nativescript_background_geolocation_lt_1.BackgroundGeolocation.stop();
    }
    },
    enumerable: true,
    configurable: true
    });
    Object.defineProperty(HelloWorldModel.prototype, "location", {
    get: function () {
    return this._location;
    },
    set: function (location) {
    this._location = location;
    this.notifyPropertyChange('location', this._location);
    },
    enumerable: true,
    configurable: true
    });
    HelloWorldModel.prototype.onChangePace = function () {
    console.log('[changePace] -', this._isMoving);
    this._isMoving = !this._isMoving;
    nativescript_background_geolocation_lt_1.BackgroundGeolocation.changePace(this._isMoving);
    };
    HelloWorldModel.prototype.onGetCurrentPosition = function () {
    nativescript_background_geolocation_lt_1.BackgroundGeolocation.getCurrentPosition({
    samples: 3,
    persist: true
    }).then(function (location) {
    console.log('[getCurrentPosition] -', location);
    }).catch(function (error) {
    console.warn('[getCurrentPosition] ERROR -', error);
    });
    };
    return HelloWorldModel;
    }(observable_1.Observable));
    exports.HelloWorldModel = HelloWorldModel;

Expected Behavior

Background location enabled when location services enabled. App fails to start if location services set to Never.

Actual Behavior

Irrespective of the settings, geolocation failed to initialise. setEnabled always false.

Steps to Reproduce

Cannot at the moment. System forced in to setEnabled True by

if (value) {
nativescript_background_geolocation_lt_1.BackgroundGeolocation.start();
}
else {
nativescript_background_geolocation_lt_1.BackgroundGeolocation.start();
}

Therefore forcing a start under any circumstances. Changing Location services also now triggers warning, but generates an error "Location Error: The operation couldn't be completed (kCLErrorDomain error 1.)
2.
3.
4.

Context

Background location

Debug logs

I have managed to reproduce this error. Putting the app in to the background results in notification that Authorisation status changed 3. From that point onwards, the app fails to run any background geolocation functions. Changing the location value between never, when using or always does not fix the error on the device and the app does not report the authorisation changes at this point.

Uninstalling and reinstalling the app does not fix the issue. could this be a persistent storage issue for this function.

App stops for no apparent reason and will not start.

Only way to ensure the app starts is to force:-

if (value) {
nativescript_background_geolocation_lt_1.BackgroundGeolocation.start();
}
else {
nativescript_background_geolocation_lt_1.BackgroundGeolocation.start();
}