Skip to content

How to customise Android notifications sounds #851

@dancb10

Description

@dancb10

I'm using gorush to send FCM and APN notifications and in my Flutter app I use messaging fcm library for notificaitons.
I've been trying to customise the notifications in Android and it works to change the icon, title, message but the sound I am unable to make it work. Do you have an example on how we should send the payload to gorush to be able to send the needed notification?
I've been trying to send channel_id and or sound but nothing works.

type GorushNotification struct {
	Tokens   []string          `json:"tokens" binding:"required"`
	Platform int               `json:"platform" binding:"required,oneof=1 2"`
	Title    string            `json:"title" binding:"required"`
	Message  string            `json:"message" binding:"required"`
	Priority string            `json:"priority" binding:"omitempty"`
	Data     map[string]string `json:"data" binding:"omitempty"`
	Android  *AndroidConfig    `json:"android,omitempty"`
}

type AndroidConfig struct {
	Notification *AndroidNotification `json:"notification,omitempty"`
}

type AndroidNotification struct {
	Title     string `json:"title,omitempty"`
	Body      string `json:"body,omitempty"`
	ChannelID string `json:"channel_id,omitempty"`
	Sound     string `json:"sound,omitempty"`
	ImageURL  string `json:"image,omitempty"`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions