How to use the react-native-background-geolocation.getCurrentPosition function in react-native-background-geolocation

To help you get started, weโ€™ve selected a few react-native-background-geolocation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github devnowcafe / runx / src / screens / Home / index.js View on Github external
getCurrentLocation = (resetGeo) => {
        BackgroundGeolocation.getCurrentPosition((location) => {
            //console.log('- getCurrentPosition success: ', location);
            this.addMarker(location);
            this.setCenter(location)
            if (resetGeo) {
                this.resetGeoLocation();
            } else {
                this.checkRunState();
            }
        }, (error) => {
            console.warn('- getCurrentPosition error: ', error);
        }, { persist: true, samples: 1 });
    }