diff options
author | Khaksar Weqar <wkhaksar1@gmail.com> | 2021-10-22 11:45:35 +0200 |
---|---|---|
committer | Khaksar Weqar <wkhaksar1@gmail.com> | 2021-10-22 11:45:35 +0200 |
commit | f686847115097cf388a775fad6f13b8bf6893193 (patch) | |
tree | be12f99ecf3d292b65a0342f6a8e7eb0f373160f /src/main/java | |
parent | a4aeff1bbf26e46270212a3a1c17e3ac47d58647 (diff) | |
download | trackermap-server-f686847115097cf388a775fad6f13b8bf6893193.tar.gz trackermap-server-f686847115097cf388a775fad6f13b8bf6893193.tar.bz2 trackermap-server-f686847115097cf388a775fad6f13b8bf6893193.zip |
title-added
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/traccar/config/Keys.java | 7 | ||||
-rw-r--r-- | src/main/java/org/traccar/notificators/NotificatorFirebase.java | 21 |
2 files changed, 19 insertions, 9 deletions
diff --git a/src/main/java/org/traccar/config/Keys.java b/src/main/java/org/traccar/config/Keys.java index 1411e8a13..f037c632f 100644 --- a/src/main/java/org/traccar/config/Keys.java +++ b/src/main/java/org/traccar/config/Keys.java @@ -745,6 +745,13 @@ public final class Keys { Collections.singletonList(KeyType.GLOBAL)); /** + * Firebase push notifications title. + */ + public static final ConfigKey<String> NOTIFICATOR_FIREBASE_TITLE = new ConfigKey<>( + "notificator.firebase.title", + Collections.singletonList(KeyType.GLOBAL)); + + /** * Pushover notification user name. */ public static final ConfigKey<String> NOTIFICATOR_PUSHOVER_USER = new ConfigKey<>( diff --git a/src/main/java/org/traccar/notificators/NotificatorFirebase.java b/src/main/java/org/traccar/notificators/NotificatorFirebase.java index 78d5da1e2..cd084080e 100644 --- a/src/main/java/org/traccar/notificators/NotificatorFirebase.java +++ b/src/main/java/org/traccar/notificators/NotificatorFirebase.java @@ -37,6 +37,8 @@ public class NotificatorFirebase extends Notificator { private final String key; public static class Notification { + @JsonProperty("title") + private String title; @JsonProperty("body") private String body; @JsonProperty("sound") @@ -67,6 +69,7 @@ public class NotificatorFirebase extends Notificator { if (user.getAttributes().containsKey("notificationTokens")) { Notification notification = new Notification(); + notification.title=Context.getConfig().getString(Keys.NOTIFICATOR_FIREBASE_TITLE); notification.body = NotificationFormatter.formatShortMessage(userId, event, position).trim(); notification.sound = "default"; @@ -77,15 +80,15 @@ public class NotificatorFirebase extends Notificator { 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); - } - }); + @Override + public void completed(Object o) { + } + + @Override + public void failed(Throwable throwable) { + LOGGER.warn("Firebase notification error", throwable); + } + }); } } |