Is it possible to add an image as icon in the notification tray using the java firebase API? I have a spring boot backend and this is how I build the AndroidConfig:
private AndroidConfig getAndroidConfig(String topic) {
return AndroidConfig.builder()
.putData("image", "url-to-image")
.setTtl(Duration.ofMinutes(2).toMillis()).setCollapseKey(topic)
.setPriority(AndroidConfig.Priority.HIGH)
.setNotification(AndroidNotification.builder().setSound("default")
.setColor("#FFFF00").setTag(topic).build()).build();
}
but there is no image here in the notification tray:
Is it even possible to do this with the java API?
Looking at AndroidNotification.builder
it has a setImage
method ( https://firebase.google.com/docs/reference/admin/java/reference/com/google/firebase/messaging/AndroidNotification.Builder.html#setImage(java.lang.String) that should do the trick.
I've only created FCM notifications in node, but the notification builder looks similar to the payload I send in node to include images.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.