Baseflow / flutter-permission-handler

Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
https://baseflow.com
MIT License
2.04k stars 848 forks source link

[Bug]: Hello, I have encountered a problem,Android phones request communication permissions from users,"Permission.phone.request()", but always return "granted" #1290

Open Yolanda2001820 opened 7 months ago

Yolanda2001820 commented 7 months ago

Please check the following before submitting a new issue.

Please select affected platform(s)

Steps to reproduce

  1. Execute 'var status=await Permission. phone. status;', status returns' denied'
  2. Afterwards, execute the code "status=await Permission. phone. request();". At this point, the application does not apply for permission from the user, but directly returns the "granted" status image

Expected results

Apply for corresponding permissions from users

Actual results

Directly return 'granted'

Code sample

bool hasPhonePermission = await requestPermissions(Permission.phone);

Future<bool> requestPermissions(Permission service) async {
    var status = await service.status;

    if (status == PermissionStatus.granted || status == PermissionStatus.limited) {
      return true;
    } else {
      // status = await Permission.location.request();
      status = await service.request();
      if (status == PermissionStatus.granted || status == PermissionStatus.limited) {
        return true;
      } else {
        return false;
      }
    }
  }

Screenshots or video

No response

Version

11.0.1

Flutter Doctor output

[✓] Flutter (Channel stable, 3.7.12, on macOS 13.3 22E252 darwin-arm64, locale zh-Hans-CN) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.3) [✓] IntelliJ IDEA Ultimate Edition (version 2023.2.2) [✓] VS Code (version 1.87.1) [✓] Connected device (4 available) [✓] HTTP Host Availability

astheras commented 7 months ago

i have a similar issue. All the same, but var status = await Permission.microphone.request(); returns denied. on Andriod 14 i manually revoked camera and mic permission and try to set permission with the request() method. camera request works fine, i have native popup to grant or deny, but the microphone request doesn't work for me, there is no pop up and response - denied. PS permission_handler: ^11.3.0

mvanbeusekom commented 7 months ago

Hi @Yolanda2001820,

Thank you for submitting this issue. To look into this issue it would be nice if you could also supply the following information:

  1. Do you experience this issue on a particular device or many Android versions? If only on a particular device can you provide us with the make and model and the Android version it is running?
  2. Did you declare the permissions (as mentioned in the Android section of the README.md file) in the your android/app/src/main/AndroidManifest.xml file? Could you include the contents of the AndroidManifest.xml file to this issue?
Yolanda2001820 commented 6 months ago

Hi @Yolanda2001820,

Thank you for submitting this issue. To look into this issue it would be nice if you could also supply the following information:

  1. Do you experience this issue on a particular device or many Android versions? If only on a particular device can you provide us with the make and model and the Android version it is running?
  2. Did you declare the permissions (as mentioned in the Android section of the README.md file) in the your android/app/src/main/AndroidManifest.xml file? Could you include the contents of the AndroidManifest.xml file to this issue?

Hello, thank you for your reply. Currently,Xiaomi phones with Android 13 and above and its sub brand Redmi phones have this issue. Other brands . This is my AndroidManifest.xml file 111

yaochangliang159 commented 3 weeks ago

i meet the same problem