GithubHelp home page GithubHelp logo

Comments (4)

matt-oakes avatar matt-oakes commented on August 16, 2024 1

The issue is that even though you have the correct permissions in AndroidManifest.xml for fine location, you are only requesting coarse permissions here:

RNLocation.requestPermission({
  ios: "always",
  android: {
    detail: "coarse"
  }
});

That should be changed to:

RNLocation.requestPermission({
  ios: "always",
  android: {
    detail: "fine"
  }
});

from react-native-location.

matt-oakes avatar matt-oakes commented on August 16, 2024

Can you let me know:

  • Which platform are you seeing this behaviour on?
  • Is this on a real device or a simulator/emulator?
  • What Android permissions do you have in AndroidManifest.xml?
  • What permissions reasons do you have in Info.plist?
  • What configuration options are you passing before subscribing to updates?

from react-native-location.

denizbas92 avatar denizbas92 commented on August 16, 2024

=> My platform is Android.
=> I am testing it on a real device.
=> My permission in AndroidManifest.xml as shown below:
ACCESS_COARSE_LOCATION
ACCESS_FINE_LOCATION
=> These are my code :
componentWillMount() {
RNLocation.configure({
distanceFilter: 0, // Meters
desiredAccuracy: {
ios: "best",
android: "balancedPowerAccuracy"
},
// Android only
androidProvider: "auto",
interval: 5000, // Milliseconds
fastestInterval: 10000, // Milliseconds
maxWaitTime: 5000, // Milliseconds
// iOS Only
activityType: "other",
allowsBackgroundLocationUpdates: false,
headingFilter: 1, // Degrees
headingOrientation: "portrait",
pausesLocationUpdatesAutomatically: false,
showsBackgroundLocationIndicator: false,
})
}

componentDidMount() {
RNLocation.requestPermission({
ios: "always",
android: {
detail: "coarse"
}
}).then(granted => {
if (granted) {
this.locationSubscription = RNLocation.subscribeToLocationUpdates(locations => {
console.log(locations)
/* Example location returned
{
speed: -1,
longitude: -0.1337,
latitude: 51.50998,
accuracy: 5,
heading: -1,
altitude: 0,
altitudeAccuracy: -1
floor: 0
timestamp: 1446007304457.029
}
*/
})
}
})
}

=> The output is like this:
[ { timestamp: 1551433571853,
speedAccuracy: 0,
speed: 0,
courseAccuracy: 0,
course: 0,
altitudeAccuracy: 0,
altitude: 0,
accuracy: 2000,
longitude: 29.00299727646425,
latitude: 41.04504504504504 } ]

=> The devices I used are ;Android 6.0 and Android 7.0 (Real device)

from react-native-location.

denizbas92 avatar denizbas92 commented on August 16, 2024

Thank you very much for your answers,it worked

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.