Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 of 5 tasks
Yolanda2001820 opened this issue Mar 15, 2024 · 3 comments
Assignees
Labels
P2 Important issues not at the top of the work list. platform: android Issue is related to the Android platform.

Comments

@Yolanda2001820
Copy link

Yolanda2001820 commented Mar 15, 2024

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS
  • Windows

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

@Yolanda2001820 Yolanda2001820 changed the title [Bug]: Android phones request communication permissions from users, but always return "granted" [Bug]: Hello, I have encountered a problem,Android phones request communication permissions from users, but always return "granted" Mar 15, 2024
@Yolanda2001820 Yolanda2001820 changed the title [Bug]: Hello, I have encountered a problem,Android phones request communication permissions from users, but always return "granted" [Bug]: Hello, I have encountered a problem,Android phones request communication permissions from users,"Permission.phone.request()", but always return "granted" Mar 15, 2024
@astheras
Copy link

astheras commented Mar 15, 2024

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

@TimHoogstrate TimHoogstrate self-assigned this Mar 18, 2024
@mvanbeusekom
Copy link
Member

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?

@mvanbeusekom mvanbeusekom added platform: android Issue is related to the Android platform. P2 Important issues not at the top of the work list. status: needs more info We need more information before we can continue work on this issue. labels Mar 18, 2024
@mvanbeusekom mvanbeusekom self-assigned this Mar 18, 2024
@github-actions github-actions bot removed the status: needs more info We need more information before we can continue work on this issue. label Mar 18, 2024
@mvanbeusekom mvanbeusekom self-assigned this Mar 18, 2024
@mvanbeusekom mvanbeusekom added the status: needs more info We need more information before we can continue work on this issue. label Mar 18, 2024
@Yolanda2001820
Copy link
Author

Yolanda2001820 commented Mar 20, 2024

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

@github-actions github-actions bot removed the status: needs more info We need more information before we can continue work on this issue. label Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Important issues not at the top of the work list. platform: android Issue is related to the Android platform.
Projects
None yet
Development

No branches or pull requests

4 participants