I know that, in android 11, the permission seeking pop up/ alert dialog never offer "always" option, rather offer without it , like the photo bellow - 
Note that, this pop up offer a "setting link" with stating that you can turn on always from the setting.
I want this pop up in my flutter project too , but I failed!
I am using permission_handler: ^8.1.1 , if I use
await Permission.location.request()
it offer me an pop up/ alert dialog like the photo bellow, but this is not what I want.
I am using a function to ask for always permission, but it never show any popup or dialog.
my code -
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() async {
await Permission.locationAlways.request();
print(Permission.locationAlways.status.then((value) => print(value)));
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
How to achieve the pop up like first photo?
AndroidMainfest.xml scenario -
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
