Ben Dellarocco Ben Dellarocco - 1 year ago 436
iOS Question

Checking if location services are enabled using react native

I am currently working on an app using react native that requires location services to be on for some of its features. I have been researching if there is a simple way to test if the user has them turned on or not so I can display a different view if they aren't. I have not found any results other than ones that are specific to IOS or Android. Has anyone else found a solution to this?

Answer Source

I was able to solve this by displaying an error message when the location could not be retrieved.

(error) => {
        this.setState({servicesOn: false}),
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download