Track location when app in background or in killed state in react native

Viewed 459

I am working on react native project where I need to track user location in background and killed state. So, I am wondering Is there anyway to tracking location when app is in the background or in killed state?

2 Answers

Check out react-native-background-geolocation

I have written an article about this.

HMS Location Kit: Running services continuously when app is in the background or killed state in React Native.

https://forums.developer.huawei.com/forumPortal/en/topic/0203451392193540113

In this tutorial, sample project also is given for better illustration.

Please note:

To receive updates we need to register headless tasks you will add registerFusedLocationHeadlessTask(), registerActivityConversionHeadlessTask(), registerActivityIdentificationHeadlessTask(), and registerGeofenceHeadlessTask() functions in index.js file.

Related