fix push notification delivery on android
CI/CD / Backend Unit Tests (push) Successful in 2m16s
CI/CD / Deploy (push) Successful in 2m6s
CI/CD / Mobile Release (push) Successful in 22m0s

This commit is contained in:
2026-07-30 15:28:12 +02:00
parent ce01ab763c
commit 45e57181a9
8 changed files with 49 additions and 223 deletions
+3 -9
View File
@@ -7,21 +7,15 @@ import {
onMessage,
onNotificationOpenedApp,
getInitialNotification,
setBackgroundMessageHandler,
} from '@react-native-firebase/messaging';
import { registerDeviceToken, listenForTokenRefresh, displayLocalNotification } from '@/services/notifications';
import { registerDeviceToken, listenForTokenRefresh } from '@/services/notifications';
import { AuthProvider, useAuth } from "@/context/AuthContext";
import { useUpdatecheck } from '@/hooks/useUpdatecheck';
import { UpdatePrompt } from '@/components/UpdatePrompt';
import Toast from 'react-native-toast-message';
// Registered at module scope so it's installed as soon as this entry file
// loads, which is required for it to fire while the app is backgrounded/killed.
setBackgroundMessageHandler(getMessaging(), async (remoteMessage) => {
const title = remoteMessage.data?.title as string | undefined;
const body = remoteMessage.data?.body as string | undefined;
await displayLocalNotification(title, body);
});
// The FCM background handler now lives in index.js (registered before this
// module loads) so it fires reliably while the app is backgrounded/killed.
function NotificationSetup() {
const { user, loading } = useAuth();