config-plugins icon indicating copy to clipboard operation
config-plugins copied to clipboard

Permission conflict error, unable to use location, on expo 47 and SDK 31

Open Goostavo opened this issue 2 years ago • 0 comments

Summary

The problem: -> My app location permission is returning on request never_ask_again. -> I added ACCESS_FINE_LOCATION on app.json file. But the Google Play refuses the App due double implementation.


The cause: The lib uses uses-permission-sdk-23 and expo uses uses-permission directives. So the config/plugin is doubliing the configuration.

When using the option neverUseForLocation it manually adds the ACCESS_FINE_LOCATION with maxSdk and blocks the location permission on newer devices.

It is added on this file: https://github.com/expo/config-plugins/blob/b86291107ec646aee5aee66362e182ec541caf34/packages/react-native-ble-plx/build/withBLEAndroidManifest.js


Workarounds:

  1. Manually remove the double permissions added by the config plugin.
  2. Remove the neverUseForLocation option.

Config Plugin

@config-plugins/react-native-ble-plx

What platform(s) does this occur on?

Android

SDK Version

47

Reproducible demo

Generated AndroidManifest.xml (Without explicit ACCESS_FINE_LOCATION)

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.qualityhub" xmlns:tools="http://schemas.android.com/tools">
  <uses-permission-sdk-23 android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30"/>
  <uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30"/>

Generated AndroidManifest.xml (With explict ACCESS_FINE_LOCATION on app.json)

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.qualityhub" xmlns:tools="http://schemas.android.com/tools">
  <uses-permission-sdk-23 android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30"/>
  <uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30"/>
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

App.json plugins session

   "permissions": [
       "ACCESS_COARSE_LOCATION",
       "ACCESS_FINE_LOCATION"
    ],
    "plugins": [
     [
       "@config-plugins/react-native-ble-plx",
       {
         "isBackgroundEnabled": true,
         "neverForLocation": true
       }
     ],

Goostavo avatar Dec 18 '22 20:12 Goostavo