react-native-geolocation
react-native-geolocation copied to clipboard
Error on requestAuthorization that lead to crash on Android
Environment
System:
OS: macOS 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Memory: 196.51 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 13.5.0 - /usr/local/bin/node
npm: 6.13.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 23, 28, 29
Build Tools: 28.0.3, 29.0.3
System Images: android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.6010548
Xcode: 11.3/11C29 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.4 => 0.60.4
Platforms
Android
Versions
- Android:
- iOS:
- react-native-geolocation:2.0.2
- react-native:0.60.4
- react:16.8.6
Description
the app is working fine on IOS, but in android it crashes with an error
RNCGeolocation.requestAuthorization() is not a function
when i have debugged the code it turned out that the function RNCGeolocation.requestAuthorization()
is undefined and thats why it throws the exception, i have went over the instructions many times, but i couldn't get it fixed.
Consider using ReactNative.PermissionsAndroid to request Android permissions.
Why is that function in the documentation if it shouldn't be used?
Is there an update on this? RNCGeolocation.requestAuthorization()
is broken on Android. Is the only workaround to use if(Platform === 'Android')
and the PermissionAndroid?
Why is that function in the documentation if it shouldn't be used?
https://github.com/react-native-geolocation/react-native-geolocation#android