react-native-background-geolocation: watchPosition method returns two success callbacks at once with same location

Your Environment

  • Plugin version: 2.10.1
  • Platform: iOS and Android
  • OS version: iOS 1O or 11, Android 6 and up
  • React Native version: 0.51.0
  • Plugin config: { stationaryRadius: 10, desiredAccuracy: 0, distanceFilter: 25, stopTimeout: 0,
    debug: false, logLevel: ‘LOG_LEVEL_OFF’, stopOnTerminate: true,
    startOnBoot: true,
    }

Expected Behavior

One callback

Actual Behavior

Two callbacks

Context

I tested my app on real devices and had the same issue.

My code:

initGeolocation() {  
	BackgroundGeolocation.configure(
		configure, 
		() => this.onAppResume(),  
		() => this.onAppSuspend()  
	);     
}

onAppResume() {    
	BackgroundGeolocation.watchPosition((location) => {  
            console.log(" \n \n Callback ---------- ");
	    
	}, (errorCode) => { 
	  this.onAppSuspend();
	}, {
	  interval: 2000,    
	  persist: false,    
	});   
}   

Result:

mar-22-2018

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

Closed for lack of feedback.