Tom says the registration code for push notifications is located in layout.dart. I paste the code that he points to below. Also, I downloaded the iOS app from the App Store and was able to send me a push notification directly to the registered device. I received it. But he says there are still issues with push notifications and he's not figuring it out.
He's asking us to tell him how we recommend handling push notifications and also inapp notifications.
He thinks that's the code that registers for push notifications:
@katiahristova
Please, tell them to try to identify the cases in which they think the notifications don't work.
Tell them to write them down as expected behavior and actual behavior.
Tom says the registration code for push notifications is located in layout.dart. I paste the code that he points to below. Also, I downloaded the iOS app from the App Store and was able to send me a push notification directly to the registered device. I received it. But he says there are still issues with push notifications and he's not figuring it out.
He's asking us to tell him how we recommend handling push notifications and also inapp notifications.
He thinks that's the code that registers for push notifications:
/// Gets permission to /// send notifications _getPermission() async { FirebaseMessaging messaging = FirebaseMessaging.instance;
/// Check permission status NotificationSettings settings = await messaging.getNotificationSettings();
/// If not authorized /// Ask for permission if (settings.authorizationStatus != AuthorizationStatus.authorized) { settings = await messaging.requestPermission( alert: true, announcement: false, badge: true, carPlay: false, criticalAlert: false, provisional: false, sound: true, );
if (settings.authorizationStatus == AuthorizationStatus.authorized) { _getToken(); print('User granted permission'); } else if (settings.authorizationStatus == AuthorizationStatus.provisional) { print('User granted provisional permission'); } else { print('User declined or has not accepted permission'); } } }
/// Get token _getToken() async { String? token = await FirebaseMessaging.instance.getToken(); //print("Token = $token");
/// You can use this token to send /// personalized push notifications for a particular device }