-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
I just tested to get the permission like this (as described in the example):
final FlutterLocalNotificationsPlugin _plugin =
FlutterLocalNotificationsPlugin();
final ios = _plugin
.resolvePlatformSpecificImplementation<
IOSFlutterLocalNotificationsPlugin
>();
NotificationsEnabledOptions? result = await ios?.checkPermissions();Since all returned where false I tried to request permission:
final ios = _plugin
.resolvePlatformSpecificImplementation<
IOSFlutterLocalNotificationsPlugin>();
await ios?.requestPermissions(alert: true, badge: true, sound: true);Popup requesting notification is is shown, as expected.
BUT if the user press not allow the requestPermissions() will not show an notification request dialog again.
After reading about this, there is a "permanentDenied" status.
Se enum from permission_handler package:
https://pub.dev/documentation/permission_handler/latest/permission_handler/PermissionStatus.html
Only supported on iOS (iOS14+) and Android (Android 14+)
permanentlyDenied → const PermissionStatus
Permission to the requested feature is permanently denied, the permission dialog will not be shown when requesting this permission. The user may still change the permission status in the settings.On Android: Android 11+ (API 30+): whether the user denied the permission for a second time. Below Android 11 (API 30): whether the user denied access to the requested feature and selected to never again show a request.
On iOS: If the user has denied access to the requested feature.
Is it possible to get this status in flutter_local_notifications?
If not, may I suggest to implement it, since you want to guide your user to settings screen to handle such case.