firebase / firebase/firebase-admin-java

FCM - Notification Image not displaying

Ouverte
#818 3 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
api: messaging
Langage dominant
Java
Étoiles
620
Forks
305
Merge moyen
3 h 23 min
PR mergées (30 j)
1

Description

### Describe your environment

* Operating System version: macOS 13.0 (22A380)
* Firebase SDK version: 9.1.1
* Library version: 9.1.1
* Firebase Product: Cloud Messaging (auth, database, storage, etc)

#### Steps to reproduce:

Images are not displayed on devices (both iOS and Android) when sending notifications with FCM.
I set the image URL using the Notification Builder.

```
List fcmTokens = List.of(...);

Notification notification = Notification.builder().setTitle("Hello").setBody("world").setImage("https://e-cdns-images.dzcdn.net/images/cover/f2d3db07f3f045a048cdacf53b5cf9dd/250x250-000000-80-0-0.jpg").build();

MulticastMessage message = MulticastMessage.builder()
.setNotification(notification)
.addAllTokens(fcmTokens).build();

BatchResponse response = FirebaseMessaging.getInstance().sendMulticast(message);
```

Note that I receive the notification on the devices, only the image is not displayed. I am able to see the image in the notification when sending it using the Firebase Console.

When investigating the issue, I discovered that other SDKs use `imageUrl` instead of `image` attribute.
For example, for NodeJS: https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.notification.md#notificationimageurl

The Java SDK still uses the `image` key instead of `imageUrl`: https://github.com/firebase/firebase-admin-java/blob/master/src/main/java/com/google/firebase/messaging/Notification.java#L33

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par le fichier référencé src/main/java/com/google/firebase/messaging/Notification.java et comparez son champ image avec la référence imageUrl liée de Node.js. Suivez la représentation de Notification dans la requête FCM, puis validez l’exemple multicast fourni sur iOS et Android ; le travail est terminé lorsque l’image de la notification s’affiche.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
firebase, java
Domaine
api, backend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
48/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.