Skip to content

Commit df07182

Browse files
committed
[NotificationPlugin] also ask for notif permissions on android
1 parent 637b31e commit df07182

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/lib/service/notification/lib/src/notification_plugin.dart

+10-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ class NotificationPlugin {
3939
Log.d('notification_plugin initialised: $initialised', 'main.dart');
4040
}
4141

42-
static void init(BuildContext context) => _requestIOSPermissions();
42+
static void init(BuildContext context) {
43+
_requestAndroidPermissions();
44+
_requestIOSPermissions();
45+
}
4346

4447
static void _requestIOSPermissions() {
4548
flutterLocalNotificationsPlugin
@@ -51,6 +54,12 @@ class NotificationPlugin {
5154
);
5255
}
5356

57+
static void _requestAndroidPermissions() {
58+
flutterLocalNotificationsPlugin
59+
.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>()
60+
?.requestNotificationsPermission();
61+
}
62+
5463
static AndroidNotificationDetails _androidPlatformChannelSpecifics(String body, String sound) {
5564
return AndroidNotificationDetails(
5665
'$sound channel id',

0 commit comments

Comments
 (0)