React-native-background-geolocation: .on('location') error callback not firing even though getCurrentPosition error callback does

Created on 14 Oct 2017  ยท  5Comments  ยท  Source: transistorsoft/react-native-background-geolocation

My Environment

  • Plugin version: 2.7.0
  • Platform: iOS
  • OS version: 10
  • Device manufacturer / model: iPhone 6 Simulator
  • React Native version: 0.44.0
  • Plugin config

    desiredAccuracy: 0,
    stationaryRadius: 25,
    distanceFilter: 10,
    stopTimeout: 1,
    debug: false,
    logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
    stopOnTerminate: false,
    startOnBoot: true,

My Setup

I have a listener attached. I have tried when app is initialized and after .configure (in the cb).

BackgroundGeolocation.on('location', l => console.log('heard location', l), e => console.log('heard error, e));

I am getting the location after .configure with

BackgroundGeolocation.getCurrentPosition(l => console.log('got location', l), e => console.log('got error, e));

Current Behavior

When I successfully get the location, the first getCurrentPosition cb runs as expected (with l) and the .on success cb fires as expected (also with l).

When I don't get the location, (i.e. there's an error), the second getCurrentPosition cb runs as expected (with e) but the .on error cb never runs.

Expected Behavior

The .on listener should run when .getCurrentPosition fails. (And it has done so in the past).

Debug logs

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
โ•‘ -[Settings load:] 
{
    activityRecognitionInterval = 10000;
    activityType = Other;
    autoSync = 1;
    autoSyncThreshold = 0;
    batchSync = 0;
    debug = 0;
    desiredAccuracy = 0;
    desiredOdometerAccuracy = 100;
    disableElasticity = 0;
    disableMotionActivityUpdates = 0;
    disableStopDetection = 0;
    distanceFilter = 10;
    enabled = 1;
    extras =     {
    };
    geofenceInitialTriggerEntry = 1;
    geofenceProximityRadius = 10000;
    geofenceTemplate = "";
    headers =     {
    };
    heartbeatInterval = 60;
    httpRootProperty = location;
    isHeartbeatEnabled = 0;
    isMoving = 0;
    locationAuthorizationAlert =     {
        cancelButton = Cancel;
        instructions = "To use background location, you must enable '{locationAuthorizationRequest}' in the Location Services settings";
        settingsButton = Settings;
        titleWhenNotEnabled = "Background location is not enabled";
        titleWhenOff = "Location services are off";
    };
    locationAuthorizationRequest = Always;
    locationTemplate = "";
    locationTimeout = 60;
    logLevel = 5;
    logMaxDays = 7;
    maxBatchSize = "-1";
    maxDaysToPersist = 1;
    maxRecordsToPersist = "-1";
    method = POST;
    minimumActivityRecognitionConfidence = 70;
    odometer = "414.8617109737623";
    params =     {
    };
    pausesLocationUpdatesAutomatically = 1;
    preventSuspend = 0;
    schedule =     (
    );
    schedulerEnabled = 0;
    startOnBoot = 1;
    stationaryRadius = 25;
    stopAfterElapsedMinutes = "-1";
    stopDetectionDelay = 0;
    stopOnTerminate = 0;
    stopTimeout = 1;
    trackingMode = 1;
    url = "";
    useSignificantChangesOnly = 0;
}
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
- updateCurrentPosition: {
}
๐ŸŽพ-[LocationManager startUpdatingLocation] ON
- updateCurrentPosition: {
}
โ„น๏ธ+[LocationAuthorization run:] status: 3
โš ๏ธ-[LocationManager locationManager:didFailWithError:] Error Domain=kCLErrorDomain Code=0 "(null)"
๐Ÿ”ด-[LocationManager stopUpdatingLocation] OFF
bug

Most helpful comment

A fix has been posted to the private repo. It won't arrive here in the public repo until the next latest stable release.

All 5 comments

I'll have a look. Btw, the latest version is 2.9.4.

Also, customer's should not use this public repo. You should use the private repo react-native-background-geolocation-android. If I post a bug-fix for this issue, it'll arrive first in the private repo. This public repo won't receive an update for several months.

Got it. I'll try reseting everything (i.e. DerivedData, Simulator) and install from that repo.

And upgrade to XCode 9 if you haven't yet.

Problem persists.

Using latest -android and XCode 9. Deleted derived data, cleaned project, cleaned build folder, and reset simulator.

A fix has been posted to the private repo. It won't arrive here in the public repo until the next latest stable release.

Was this page helpful?
0 / 5 - 0 ratings