Closed toknT closed 11 months ago
I forget to change the xml and on Andorid 14 it should usePermission.videos.request
, sorry.
<!-- Permissions options for the `storage` group -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
if (info.version.sdkInt >= 33) {
// android 13+
status = await Permission.videos.request();
} else if (info.version.sdkInt >= 30) {
// android 11+ `storage.request()` still work on 11
// status = await Permission.manageExternalStorage.request(); // full screen
status = await Permission.storage.request(); // dialog
} else {
status = await Permission.storage.request();
}
No meu ele não aponta erro, simplesmente não exibe o dialogo para solicitar permissão. Mesmo realizando todas as alterações indicadas na pub dev do pacote. Android 14.
Same For me Not Showing any dialog either.
@Mashi-91 check you AndroidManifest.xml ,use Permission.videos.request()
on android 13 or 13+, and restart the emulator not reload.
if (info.version.sdkInt >= 33) {
// android 13+
status = await Permission.videos.request();
} else if (info.version.sdkInt >= 30) {
// android 11+ `storage.request()` still work on 11
// status = await Permission.manageExternalStorage.request(); // full screen
status = await Permission.storage.request(); // dialog
} else {
status = await Permission.storage.request();
}
Same error here. I'm using a real device with android 14 and when permission is denied, when i try to ask user to give me permission the dialog dosen't appears....
Im trying to use Location, to use bluetooth scan method and find another near devices:
void _checkPermissions() async {
var status = await Permission.locationWhenInUse.status;
if (status == PermissionStatus.granted) {
showSnackbar('Permissão concedida.');
} else if (status == PermissionStatus.permanentlyDenied) {
// tratar aqui
showSnackbar('Permissão negada permanentemente');
} else if (status == PermissionStatus.denied) {
final curContext = context;
if (curContext.mounted) {
await showDialog(
context: curContext,
builder: (ctx) => AlertDialog(
title: const Text('Permissão não concedida'),
content: const Text(
'''Para sua comodidade, conceda a permissão para o uso da '''
'''localização para 'sempre permitir durante o uso' do '''
'''aplicativo Aferineu.'''),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('Fechar'),
),
],
),
);
}
await Permission.locationWhenInUse.request(); // works until android 11
//await Permission.location.request();
//dosen't works too..
/*
bool isShown =
await Permission.locationWhenInUse.shouldShowRequestRationale;
*/
//requisitar aqui
var status = await Permission.locationWhenInUse.status;
if (status != PermissionStatus.granted) {
showSnackbar('Permissão não concedida');
} else {
showSnackbar('Permissão concedida.');
}
} else {
showSnackbar('Erro ao checar permissão.');
}
}
Manifest permissions:
<uses-permission android:name="android.permission.INTERNET" />
<!-- New Bluetooth permissions in Android 12
https://developer.android.com/about/versions/12/features/bluetooth-permissions -->
<!--Before Android 12 (but still needed location, even if not requested)-->
<!-- uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" android:maxSdkVersion="30" / -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30"/>
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30"/>
<!-- uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" / -->
<!--From Android 12-->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<!-- Since Bluetooth classis is a basic requirement for our app -->
<uses-feature android:name="android.hardware.bluetooth" android:required="true" />
<!-- Adding Bluetooth BLE for future new devices implementions -->
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true" />
is there some way to ask user again if the previous status are denied on android 12 and 14?
Kind Regards.
Please check the following before submitting a new issue.
Please select affected platform(s)
Steps to reproduce
In my app , it need to download pdf files to download folder, and I do it just like this issue: https://github.com/Baseflow/flutter-permission-handler/issues/955 .
Expected results
require the user permission
Actual results
do no thing and this error in console
Code sample
Screenshots or video
No response
Version
11.0.1
Flutter Doctor output