From d0b59b0b0a5b7aab2840cacaaa17ea29203aa8d6 Mon Sep 17 00:00:00 2001 From: "J. A. Messias" Date: Mon, 9 Sep 2024 14:43:46 -0300 Subject: [PATCH] WIP --- android/app/src/main/AndroidManifest.xml | 13 ++++++++++--- .../notifications/firebase_messaging_service.dart | 13 +++++++++++++ lib/firebase_options.dart | 9 +++++---- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index c59078fa..eaa9867b 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -9,6 +9,7 @@ + + + + - - - @@ -60,6 +61,12 @@ + + + + + + diff --git a/lib/backend/notifications/firebase_messaging_service.dart b/lib/backend/notifications/firebase_messaging_service.dart index 727c9762..ca4e021f 100644 --- a/lib/backend/notifications/firebase_messaging_service.dart +++ b/lib/backend/notifications/firebase_messaging_service.dart @@ -1,5 +1,6 @@ import 'dart:developer'; +import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:hub/app_state.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; @@ -40,6 +41,18 @@ class FirebaseMessagingService { FirebaseMessaging.onMessage.listen((RemoteMessage message) { handleMessage(message); }); + + FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) { + log('A Message was opened: $message'); + }); + + FirebaseMessaging.instance + .getInitialMessage() + .then((RemoteMessage? message) { + if (message != null) { + log('A Message was opened: $message'); + } + }); } Future updateDeviceToken() async { diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart index 4e9e28fd..ac64bcb6 100644 --- a/lib/firebase_options.dart +++ b/lib/firebase_options.dart @@ -73,9 +73,10 @@ class DefaultFirebaseOptions { projectId: 'accessmoblie-da839', databaseURL: 'https://accessmoblie-da839.firebaseio.com', storageBucket: 'accessmoblie-da839.appspot.com', - androidClientId: '187064172787-7et0qu5p2qtmisvqgndn3kfi1b7u9ifl.apps.googleusercontent.com', - iosClientId: '187064172787-c5gs7fvp78om9r7dofkjn2qmpumkuvig.apps.googleusercontent.com', + androidClientId: + '187064172787-7et0qu5p2qtmisvqgndn3kfi1b7u9ifl.apps.googleusercontent.com', + iosClientId: + '187064172787-c5gs7fvp78om9r7dofkjn2qmpumkuvig.apps.googleusercontent.com', iosBundleId: 'br.com.freaccess.hub', ); - -} \ No newline at end of file +}