expo: Cannot get location after detach
Hello,
I had to detach the app I am working on to access some native resources (not geolocation), but the app also requires the location of the user.
The code below does not display anything, not even the error function is firing.
navigator.geolocation.getCurrentPosition( (position) => { console.log(position) }, (error) => { this.getLocation(error) }, { enableHighAccuracy: false, timeout: 20000, maximumAge: 0, distanceFilter: 0.000001 }, );
Please can someone help me
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (6 by maintainers)
@ntk860 glad you figured it out! What was the problem? I’m going to close this since it sounds like you are good to go. 😃
@ntk860 yeah, even in a detached app I’m having no issue running the code in your snack 😕 Could you verify that you have the
NSLocationWhenInUseUsageDescriptionkey in your project’s Info.plist?Hi @ntk860 - I put the code you provided into a snack here, and it worked fine on my iOS device after I turned on location services. Could you make sure that you have location services on? If so, and the snack above still does not work for you, could you tell us what type of device you’re testing on?
ios or android?