Skip to content

Custom PUSH notifications sound in iOS??? #6697

@Syirrus

Description

@Syirrus

Rocket.Chat Version: 0.55.0
Running Instances: 1
DB Replicaset OpLog: None
Node Version: Latest

Does anyone know how to get custom sound notifications to play on iOS? I have it working in Android by changing the name of my sound file to "chime" and placing it in the appropriate directory on my Cordova build. I think the problem with it not working (push notifications do work with default sound) the file name needs to be explicitly named. "chime.mp3". I've been looking at the PushNotification.js class in particular the method: send();

	send({ roomName, roomId, username, message, usersTo, payload }) {
		let title;
		if (roomName && roomName !== '') {
			title = `${ roomName }`;
			message = `${ username }: ${ message }`;
		} else {
			title = `${ username }`;
		}
		const icon = RocketChat.settings.get('Assets_favicon_192').url || RocketChat.settings.get('Assets_favicon_192').defaultUrl;
		const config = {
			from: 'push',
			badge: 1,
			sound: 'chime',
			title: title,
			text: message,
			payload,
			query: usersTo,
			notId: this.getNotificationId(roomId),
			gcm: {
				style: 'inbox',
				summaryText: '%n% new messages',
				image: RocketChat.getURL(icon, { full: true })
			},
			apn: {
				text: title + ((title !== '' && message !== '') ? '\n' : '') + message
			}
		};

		return Push.send(config);
	}

If the file needs to be explicitly named for iOS to recognize, how could we determine if the the client is an iOS device or Android to adjust the name of the file accordingly?

Also:
Does the (apn:{} object) in Rocket.Chat object pertain to APPLE'S (aps:{} object)?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions