Integrate react-native-background-fetch in existing React Native application

Job ID: 33095881

Budget: $10 – $30 CAD

I added React Native Geolocation Service but I need help implementing react-native-background-fetch to fetch location in the background.

This is the library to implement:
https://github.com/transistorsoft/react-native-background-fetch

This is the code I have for fetching location:
const getCurrentLocation = () => {
console.log("get current location function called");
Geolocation.getCurrentPosition(
(position) => {
console.log("Latitude : ", position.coords.latitude);
console.log("Longitude : ", position.coords.longitude);
// console.log(position);
// console.log("-----" + position.coords.latitude);
// console.log("----" + position.coords.longitude);
let lat = position.coords.latitude;
let long = position.coords.longitude;
setLongitude(lat);
setLatitude(long);
sendLocation(lat, long);
},
(error) => {
console.log(error);
alert(error.message);
},
{
enableHighAccuracy: true,
timeout: 15000,
maximumAge: 0,
// interval: 10000,
}
);
};
Related categories: Mobile App Development Android React Native