Skip to content

Android background geolocation #255

@dukvanduken

Description

@dukvanduken

Hi there!
I tried to find free solution for background location for Android RN app and used this react-native-geolocation lib.

But it seems it not support background geolocation. I used this code:
`
useEffect(() => {
Geolocation.setRNConfiguration({
skipPermissionRequests: false,
locationProvider: 'android',
})

Geolocation.watchPosition(
  ({ coords: { latitude: lat, longitude: lon }}) => {
    // my code here...
  },
  (error) => console.error(error),
  { interval: 1000, enableHighAccuracy: true, distanceFilter: 1 },
)

}, [])
`

It works fine but only app is in focus.
Backgrounded app do not watch for position.

I saw this module https://github.com/transistorsoft/react-native-background-geolocation but it's paid and I want to use this lib.

Do I have any possibilities to get background location?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions