Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Added FCM message functionality to NotificationService

Rich Turner5b46eb109b80
diff --git a/manager/src/main/java/org/openremote/manager/notification/NotificationService.java b/manager/src/main/java/org/openremote/manager/notification/NotificationService.java
index d6d261a60..30e70a2d8 100644
--- a/manager/src/main/java/org/openremote/manager/notification/NotificationService.java
+++ b/manager/src/main/java/org/openremote/manager/notification/NotificationService.java
@@ -19,6 +19,8 @@
*/
package org.openremote.manager.notification;
+import com.google.firebase.messaging.AndroidConfig;
+import com.google.firebase.messaging.ApnsConfig;
import com.google.firebase.messaging.Notification;
import org.openremote.container.Container;
import org.openremote.container.ContainerService;
@@ -108,6 +110,14 @@ public class NotificationService implements ContainerService {
).setParameter("userId", userId).getResultList());
}
+ public boolean isFcmEnabled() {
+ return fcmDeliveryService.isValid();
+ }
+
+ public boolean sendFcmMessage(FCMTargetType targetType, String target, FCMMessagePriority priority, Notification notification, Map<String, String> data, Date expiration, AndroidConfig.Builder androidConfigBuilder, ApnsConfig.Builder apnsConfigBuilder) {
+ return fcmDeliveryService.sendMessage(targetType, target, priority, notification, data, expiration, androidConfigBuilder, apnsConfigBuilder);
+ }
+
//TODO: Unify the notification service to support push, email, SMS, etc.
public void notifyConsole(String consoleId, AlertNotification alertNotification) {
AssetQuery consoleQuery = new AssetQuery()