From 44a123b96892c383f11442a3bb46126a48cf68f8 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 19 Feb 2024 11:57:43 +0300 Subject: [PATCH] apns token for ios. --- .../notification/firebase_notification_manger.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/controllers/notification/firebase_notification_manger.dart b/lib/controllers/notification/firebase_notification_manger.dart index 58bd71d3..62d6c06f 100644 --- a/lib/controllers/notification/firebase_notification_manger.dart +++ b/lib/controllers/notification/firebase_notification_manger.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:io'; import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; @@ -34,7 +35,11 @@ class FirebaseNotificationManger { ); if (settings.authorizationStatus == AuthorizationStatus.authorized) { - token = await messaging.getToken(); + if (Platform.isIOS) { + token = await messaging.getAPNSToken(); + } else { + token = await messaging.getToken(); + } } print("pushToken:$token"); return token;