Location permission request not coming both iOS and Android
See original GitHub issueSystem: OS: macOS 10.15.7 CPU: (4) x64 Intel® Core™ i5-5350U CPU @ 1.80GHz Memory: 50.46 MB / 8.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 13.12.0 - /usr/local/bin/node Yarn: Not Found npm: 6.14.5 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.9.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 13.7, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 Android SDK: Not Found IDEs: Android Studio: 4.0 AI-193.6911.18.40.6626763 Xcode: 11.7/11E801a - /usr/bin/xcodebuild Languages: Java: 11.0.8 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.62.2 => 0.62.2 npmGlobalPackages: react-native: Not Found
using : react-native-geolocation-service: “^5.0.0”
Not able to get permission popup. It won’t as for permission.
componentDidMount = () => {
Geolocation.getCurrentPosition(
(info) => {
let lat = info.coords.latitude;
let lng = info.coords.longitude;
this.getLocation(lat, lng);
},
(err) => {
console.log('location err=>', err);
alert('Location error');
},
);
};
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
@Agontuk I am using the following function to request permission and later calling it inside
useEffect()
beforeGeolocation.getCurrentPosition()
. Getting no error and no location. Am I doing anything wrong? Can you share any working example?Also modified
build.gradle
&AndroidManifest.xml
just like you mentioned in the docs.Why are you using
useEffect
for this ?useEffect
will be called every time after render, so not a good place to use this (unless using it only once). AlsosetRNConfiguration
is deprecated in recent versions andrequestAuthorization
method needs an argument. Please check the documentation.