react-native-geolocation icon indicating copy to clipboard operation
react-native-geolocation copied to clipboard

Error on requestAuthorization that lead to crash on Android

Open anaszgh opened this issue 4 years ago • 5 comments

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.

anaszgh avatar Feb 19 '20 19:02 anaszgh

Consider using ReactNative.PermissionsAndroid to request Android permissions.

MorganTrudeau avatar Feb 27 '20 22:02 MorganTrudeau

Why is that function in the documentation if it shouldn't be used?

SirCameron avatar Apr 23 '20 10:04 SirCameron

Is there an update on this? RNCGeolocation.requestAuthorization() is broken on Android. Is the only workaround to use if(Platform === 'Android') and the PermissionAndroid?

mexmirror avatar Aug 17 '20 13:08 mexmirror

Why is that function in the documentation if it shouldn't be used?

https://github.com/react-native-geolocation/react-native-geolocation#android

cresenciof avatar Mar 16 '21 17:03 cresenciof

It may be related with issue-272.

Check the last part of my comment in the previous issue.

dgreasi avatar Sep 20 '23 11:09 dgreasi