firebase / firebase/firebase-admin-java
Android device only receive 1 notification when offline.
- Langage dominant
- Java
- Étoiles
- 620
- Forks
- 305
- Merge moyen
- 3 h 23 min
- PR mergées (30 j)
- 1
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par l’utilisation de AndroidConfig.builder().setCollapseKey et de la configuration de Firebase Admin Java SDK 9.1.1 décrite dans l’issue. Reproduisez le comportement avec un appareil Android en mode avion, en envoyant trois notifications avec des clés de regroupement distinctes via le endpoint FCM HTTP v1, puis comparez le résultat avec la configuration APNs. Le travail est terminé lorsqu’il est déterminé si le comportement de livraison d’Android est attendu ou lorsqu’un problème documenté du SDK ou de FCM est identifié.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- android, java
- Domaine
- backend, mobile-dev
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 30/100