Skip to content

Commit 5a977f2

Browse files
committed
Add notification support for FCM
1 parent cbbcbd1 commit 5a977f2

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

android/service.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ func (s *Service) Queue(msg *core.Message) {
5151
Data: msg.Json,
5252
TimeToLive: &ttl}
5353

54+
if msg.Title != "" && msg.Text != "" {
55+
fcmMsg.Notification = &fcm.Notification{Title: msg.Title, Body: msg.Text, Icon: msg.Icon}
56+
}
5457
if msg.Priority == core.PriorityHigh {
5558
fcmMsg.Priority = "high"
5659
} else {

core/model.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ type Message struct {
2121
Priority int
2222
Expiration int
2323

24+
Title string
25+
Text string
26+
Icon string
2427
// GCM related fields
2528
Json map[string]interface{}
2629

0 commit comments

Comments
 (0)