firebase / firebase/firebase-admin-java

Android device only receive 1 notification when offline.

Offen
#812 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
620
Forks
305
Ø Merge
3 Std. 23 Min.
Gemergte PRs (30 T.)
1

Beschreibung

My app sends non-collapsible push notification.
When push notification are sent while device is online, everything works fine. Notifications are sent one by one. The problem is that if the device is offline (closed or airplane mode) only the last notification sent is received when the device come back online.

A work around that seems to be popular online is to generate unique collapseKey to force firebase to push notification in separate "collapse group".
I know the limit is only 4 collapse key, but it is enough notifications for the app I'm building.

I've achieved the desired result on IOS by settings my apns-collapse-id to a random UUID for each notifications but now that I'me trying with android it doesn't seems to work.

I uses
Firebase-admin version 9.1.1
```

com.google.firebase
firebase-admin
9.1.1

```
This library uses FCM HTTP v1 endpoint

The collapseKey fields works.
When setting it with this function : `AndroidConfig.builder().setCollapseKey("non_unique_collapse_key").build()`

The notifications are overwritten.

If I set it like this : `AndroidConfig.builder().setCollapseKey(UUID.randomUUID().toString()).build()`

All notification are sent separately.

The problem is that if I put my android to airplane mode, send myself 3 notifications (with 3 different collapse_key)
When I put my device back online, I only receive the last notification sent.

The same cannot be said for IOS.

I set my notification like so :
```
ApnsConfig.builder().putHeader("apns-collapse-id", collapseKey)
.setAps(Aps.builder().setAlert(
ApsAlert.builder().setTitle(title).setBody(notificationContent).build()).build())
.build();
```

and when I put my iphone back online, I receive 3 notifications.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der Verwendung von AndroidConfig.builder().setCollapseKey und der in der Issue beschriebenen Konfiguration des Firebase Admin Java SDK 9.1.1. Reproduziere das Verhalten mit einem Android-Gerät im Flugmodus, indem du über den FCM HTTP v1-Endpunkt drei Benachrichtigungen mit unterschiedlichen Collapse Keys sendest, und vergleiche das Ergebnis mit der APNs-Konfiguration. Als abgeschlossen gilt die Aufgabe, wenn festgestellt wurde, ob das Zustellungsverhalten von Android erwartungsgemäß ist, oder ein dokumentiertes Problem im SDK oder in FCM identifiziert wurde.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
android, java
Bereich
backend, mobile-dev
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.