aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/config/Keys.java7
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorFirebase.java21
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);
+ }
+ });
}
}