From 69711506eac603942e30bc6721b7ef46d3c02b18 Mon Sep 17 00:00:00 2001 From: Krille Date: Wed, 19 Feb 2025 16:52:13 +0100 Subject: [PATCH] fix: Request notification permissions on iOS before getToken --- lib/utils/background_push.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart index 7b70165ca..22d067a94 100644 --- a/lib/utils/background_push.dart +++ b/lib/utils/background_push.dart @@ -72,6 +72,9 @@ class BackgroundPush { void _init() async { try { + if (PlatformInfos.isIOS) { + await firebase?.requestPermission(); + } await _flutterLocalNotificationsPlugin.initialize( const InitializationSettings( android: AndroidInitializationSettings('notifications_icon'), @@ -147,9 +150,7 @@ class BackgroundPush { Set? oldTokens, bool useDeviceSpecificAppId = false, }) async { - if (PlatformInfos.isIOS) { - await firebase?.requestPermission(); - } else if (PlatformInfos.isAndroid) { + if (PlatformInfos.isAndroid) { _flutterLocalNotificationsPlugin .resolvePlatformSpecificImplementation< AndroidFlutterLocalNotificationsPlugin>()