flutter_notification_permissions
flutter_notification_permissions copied to clipboard
[Android] Using 'requestNotificationPermissions' doesn't wait for result
Hi,
I'm using 'requestNotificationPermissions' in this way: var hasNotificationPermissions = true;
static Future<bool> checkNotificationPermissions() async {
var hasNotificationPermissions = true;
var hasNotificationPermissionsStatus =
await NotificationPermissions.getNotificationPermissionStatus();
if (hasNotificationPermissionsStatus == PermissionStatus.denied ||
hasNotificationPermissionsStatus == PermissionStatus.unknown) {
hasNotificationPermissionsStatus =
await NotificationPermissions.requestNotificationPermissions(
iosSettings: const NotificationSettingsIos(
alert: true, sound: false, badge: false),
openSettings: true);
if (hasNotificationPermissionsStatus == PermissionStatus.denied ||
hasNotificationPermissionsStatus == PermissionStatus.unknown) {
hasNotificationPermissions = false;
}
}
return Future.value(hasNotificationPermissions);
}
In this case, requestNotificationPermissions open the app setting, but the code continue and ignore the await, it doesn't waiting to the pressing of the back button in the settings screen and set hasNotificationPermissionsStatus with PermissionStatus.denied.
How can I solve this behavior?
Thanks.
Same issue, please fix this bug
Same issue