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

fix: crash on app start when permission is denied

Open g4rb4g3 opened this issue 1 year ago • 0 comments

Overview

This PR fixes a crash when starting an app using this library and denying the location permission. Instead of throwing an exception on native side that is not handled it will emit the error to rn so it can be handled properly there.

Test Plan

Call Geolocation.watchPosition and deny the permission -> without this PR the app will crash. java.lang.SecurityException GeolocationModule.java:142 Looks like the app doesn't have the permission to access location. Add the following line to your app's AndroidManifest.xml: <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> With this PR the error callback is triggered and the missing permission can be handled.

g4rb4g3 avatar Mar 22 '24 09:03 g4rb4g3