Android - requestPermission not asking for permission

See original GitHub issue

Describe the bug When calling location.requestPermission(), Android does not ask for permission

Expected behavior A popup should appears, asking for permission

Tested on:

  • OnePlus 6 (Android 9)
  • Pixel XL Emulator (API 28)

Additional logs

Exception has occurred. PlatformException (PlatformException(PERMISSION_DENIED_NEVER_ASK, Location permission denied forever- please open app settings, null))

I also created this thread on Stackoverflow.

Future<LocationData> _getLocation() async {
  LocationData currentLocation;

  var test = await location.requestPermission();

  try {
    currentLocation = await location.getLocation();
  } catch (e) {
    currentLocation = null;
  }
  return currentLocation;
}

When I go to the app Settings on my OP6, the permissions is greyed out, saying “no permissions requested”

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
Lyokonecommented, Apr 13, 2019

Okay it seems setup correctly. That’s strange because when you add the plugin to your app, Flutter is supposed to automatically add the requested permission in your AndroidManifest.xml so it should appear in your app’s settings. Can you try to do a flutter clean to see if this is not a build problem ?

3reactions
Roboustecommented, Apr 13, 2019

omg, you are a genius, I got the popup !

Thank you !

Read more comments on GitHub >

github_iconTop Results From Across the Web

ActivityCompat.requestPermissions not showing dialog box
I had a need to request permission for WRITE_EXTERNAL_STORAGE but was not ... Android) the Permission dialog includes a check box labeled "Never...
Read more >
Request app permissions - Android Developers
Overview · Build a calling app · Prevent caller ID spoofing · Telephony IDs. Wi-Fi. Request permission to access nearby Wi-Fi devices ...
Read more >
Android: Request Permissions do not show dialog boxes
// No explanation needed, we can request the permission. ActivityCompat.requestPermissions( thisActivity, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
Read more >
How to Request Permissions in Android Application?
Android provides several methods that can be used to request permission, such as requestPermissions(). Syntax: ActivityCompat.requestPermissions ...
Read more >
Android Runtime Permissions Example - DigitalOcean
Requesting Android Runtime Permissions. The method requestPermissions(String[] permissions, int requestCode); is a public method that is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found