I made small changes. so far it helped me
git.patch
diff --git a/server/android_notification_server.go b/server/android_notification_server.go
index 9df076f..c0c96fc 100644
--- a/server/android_notification_server.go
+++ b/server/android_notification_server.go
@@ -4,6 +4,7 @@
package server
import (
+ "strings"
"time"
fcm "github.com/appleboy/go-fcm"
@@ -16,6 +17,13 @@ type AndroidNotificationServer struct {
AndroidPushSettings AndroidPushSettings
}
+func truncateText(s string, max int) string {
+ if max > len(s) {
+ return s
+ }
+ return s[:strings.LastIndex(s[:max], " ")]
+}
+
func NewAndroidNotificationServer(settings AndroidPushSettings, logger *Logger, metrics *metrics) NotificationServer {
return &AndroidNotificationServer{
AndroidPushSettings: settings,
@@ -80,6 +88,10 @@ func (me *AndroidNotificationServer) SendNotification(msg *PushNotification) Pus
To: msg.DeviceID,
Data: data,
Priority: "high",
+ Notification: &fcm.Notification{
+ Title: truncateText(msg.ChannelName, 75),
+ Body: truncateText(emoji.Sprint(msg.Message), 175),
+ },
}
if me.AndroidPushSettings.AndroidAPIKey != "" {
@@ -95,6 +107,7 @@ func (me *AndroidNotificationServer) SendNotification(msg *PushNotification) Pus
start := time.Now()
resp, err := sender.SendWithRetry(fcmMsg, 2)
+
if me.metrics != nil {
me.metrics.observerNotificationResponse(PushNotifyAndroid, time.Since(start).Seconds())
}