Describe the bug
When calling location.requestPermission(), Android does not ask for permission
Expected behavior
A popup should appears, asking for permission
Tested on:
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"
Hey, if there is no permission requested in your app's settings, are you sure to TargetSDK 28 in your build.gradle ?
I have two build.gradle files, one in root of appfolder, and one in srcfolder.
I don't see this line in the first file, but I do see this in the second one :
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.mobile_app"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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 ?
omg, you are a genius, I got the popup !
Thank you !
Hehe glad it worked 馃榿
I'm glad I wasn't the only having this problem
Hi @Lyokone,
I just got stuck with this same problem. Could I recommend adding the flutter clean to the READM? I'm not sure how possible it would be but can you somehow check if the permission has been added to the AndroidManifest.xml?
Thanks
Most helpful comment
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.xmlso it should appear in your app's settings.Can you try to do a
flutter cleanto see if this is not a build problem ?