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

Andriod 12 requesting coarse permission requests fine permission automatically

Open Matzielab opened this issue 2 years ago • 3 comments

Bug summary

Android 12 comes with approximate location option when asking for fine permission, this sets the coarse location permission flag. You can ask for only approximate location by requesting coarse location permission but when trying this it shows the popover and then calls for fine permisson and a "switch to fine location" popover is shown. If fine location switch is denied its shown again for a total of 2 times and then it doesnt show. coarse location permisson flag is set correctly

Library version

3.1.0

Environment info

System:
    OS: macOS 11.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 1.47 GB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.16.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.11 - /usr/local/bin/npm
    Watchman: 2021.10.18.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6626763
    Xcode: 13.1/13A1030d - /usr/bin/xcodebuild
  Languages:
    Java: 14.0.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.4 => 0.63.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  1. Call Permissions.request(PERMISSIONS.ANDROID.ACCESS_COARSE_LOCATION); on an Android 12 device
  2. Get approximate location permission approve popover, approve the request
  3. Get fine location permission approve popover

Reproducible sample code

import Permissions from 'react-native-permissions';

Permissions.request(PERMISSIONS.ANDROID.ACCESS_COARSE_LOCATION);

Matzielab avatar Nov 08 '21 13:11 Matzielab

Did you set ACCESS_FINE_LOCATION in your AndroidManifest.xml?

zoontek avatar Nov 08 '21 13:11 zoontek

Yess, both fine and coarse are in the manifest. At first we only want to access coarse location and when needed convert it to fine location

Matzielab avatar Nov 08 '21 14:11 Matzielab

Are you sure this is an issue with the library and not Android 12 directly? I found a lot of occurence of ACCESS_COARSE_LOCATION in their issue tracker 😕 https://issuetracker.google.com/issues?q=ACCESS_COARSE_LOCATION

zoontek avatar Nov 09 '21 10:11 zoontek

Closing this since I couldn't reproduce it, and nobody came with a similar issue.

zoontek avatar Feb 26 '23 14:02 zoontek