X-Guard / react-native-flic2

Use Flic 2 within your React Native application with ease.
Other
8 stars 9 forks source link

Location Permission Issue with react-native-flic2 Library on Android #48

Closed JB-CHAUVIN closed 1 month ago

JB-CHAUVIN commented 1 month ago

Description: I am experiencing an issue with the react-native-flic2 library in my React Native project on Android. When I include the react-native-flic2 library and request location permissions, the app requests only approximate location of the device. However, when I do not include this library, the app requests precise & approximate location permission (desired behaviour).

Steps to Reproduce:

  1. Create a new React Native project.
  2. Add the react-native-flic2 library.
  3. Request location permissions using a library like react-native-permissions or PermissionsAndroid.
  4. Observe the permission request behavior on an Android 14 device (Samsung).

Expected Behavior: The app should request the same location permissions regardless of whether the react-native-flic2 library is included or not.

Actual Behavior:

Environment: React Native version: 0.74.3 react-native-flic2 version:0.3.26 react-native-permissions: 4.1.5 Android version: Android 14 Device: Samsung Target Android SDK : 34

jdegger commented 1 month ago

I quickly googled this. It seems like we can avoid this by adding a declaration that we do not use the location when we scan Bluetooth.

https://developer.android.com/develop/connectivity/bluetooth/bt-permissions

https://developer.android.com/develop/connectivity/bluetooth/bt-permissions#assert-never-for-location

I'm currently on my phone. Can you add this assertion in your app to see if that works? Otherwise we might need to change the package.

JB-CHAUVIN commented 1 month ago
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" tools:remove="android:usesPermissionFlags" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:remove="maxSdkVersion" />

Fixed the issue !