Giter Site home page Giter Site logo

Comments (2)

matt-oakes avatar matt-oakes commented on July 25, 2024 1

Hi there,

This method is actually only available on iOS and from your screenshot, it looks like you are attempting to call it on Android. I recommend checking that you are on iOS before calling it (Platform.OS === "ios").

What you likely want to do is to subscribe to location updates with a large distance filter so your callback only gets called when a large distance change happens. You can do this cross-platform like this:

RNLocation.configure({
    distanceFilter: 500, // Meters
    desiredAccuracy: {
      ios: "best",
      android: "balancedPowerAccuracy"
    }
})

// Subscribe
const unsubscribe = RNLocation.subscribeToLocationUpdates(locations => {
  ...
})

// Unsubscribe
unsubscribe();

I do think the error message for calling startMonitoringSignificantLocationChanges on Android could be improved, so I'll leave this open as a reminder for me to do that.

Let me know if you have any other issues.

from react-native-location.

arhmnsh avatar arhmnsh commented on July 25, 2024

Hi @matt-oakes,
Thanks for the reply!
Got confused with subscribeToLocationUpdates and subscribeToSignificantLocationUpdates.

Very helpful library, btw!

from react-native-location.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.