It's in templates.
I am looking into changing the notification payload so it uses a custom sound for the notification in Firebase. To achieve this could I just change the NotificatorFirebase.java file as I did below by adding notification.sound field?
@Override
public void sendSync(long userId, Event event, Position position) {
final User user = Context.getPermissionsManager().getUser(userId);
if (user.getAttributes().containsKey("notificationTokens")) {
Notification notification = new Notification();
notification.body = NotificationFormatter.formatShortMessage(userId, event, position).trim();
notification.sound = "myCustomSound.wav";
Message message = new Message();
message.tokens = user.getString("notificationTokens").split("[, ]");
message.notification = notification;
Context.getClient().target(URL).request()
.header("Authorization", "key=" + key)
.async().post(Entity.json(message), new InvocationCallback<Object>() {
@Override
public void completed(Object o) {
}
@Override
public void failed(Throwable throwable) {
LOGGER.warn("Firebase notification error", throwable);
}
});
}
}
Would also have to make changes to Notification class shown below correct?
public static class Notification {
@JsonProperty("body")
private String body;
@JsonProperty("sound")
private String sound;
}
Hi,
I am receiving push notifications from traccar via firebase in my Android app but not sure where to change the notification text message or format..
Can you please help me on this..
Thanks in advance.