diff --git a/sojorn_app/android/app/src/main/AndroidManifest.xml b/sojorn_app/android/app/src/main/AndroidManifest.xml
index ae38f06..9f4cb26 100644
--- a/sojorn_app/android/app/src/main/AndroidManifest.xml
+++ b/sojorn_app/android/app/src/main/AndroidManifest.xml
@@ -52,6 +52,11 @@
+
+
+
+
+
diff --git a/sojorn_app/lib/services/notification_service.dart b/sojorn_app/lib/services/notification_service.dart
index 2b146d3..7e9a4bd 100644
--- a/sojorn_app/lib/services/notification_service.dart
+++ b/sojorn_app/lib/services/notification_service.dart
@@ -229,7 +229,10 @@ class NotificationService {
});
// Handle messages when app is opened from notification
- FirebaseMessaging.onMessageOpenedApp.listen(_handleMessageOpen);
+ FirebaseMessaging.onMessageOpenedApp.listen((msg) {
+ debugPrint('[FCM] onMessageOpenedApp triggered: ${msg.notification?.title}');
+ _handleMessageOpen(msg);
+ });
// Handle foreground messages - show in-app banner
FirebaseMessaging.onMessage.listen((message) {
@@ -241,9 +244,9 @@ class NotificationService {
// Check for initial message (app opened from terminated state)
final initialMessage = await _messaging.getInitialMessage();
if (initialMessage != null) {
- debugPrint('[FCM] App opened from notification');
- // Delay to allow navigation setup
- Future.delayed(const Duration(milliseconds: 500), () {
+ debugPrint('[FCM] App opened from TERMINATED state via notification: ${initialMessage.notification?.title}');
+ // Delay to allow navigation setup (extended to 1000ms for safety)
+ Future.delayed(const Duration(milliseconds: 1000), () {
_handleMessageOpen(initialMessage);
});
}