Problem/Motivation

We send a message with firebase, but it plays no sound on the receiving devices.

A little bit more detail: we use it in a pwa-environment. When you use "add to homescreen" (pwa-default) it actually does play sound. But we also use it in an app, with pwabuilder, en in these apps no sound is played.

Steps to reproduce

Create a pwa, than package it with pwabuilder and publish it. Push a test-notification to a device.

Proposed resolution

Add $message = $message->withDefaultSounds();.

User interface changes

None

API changes

None

Data model changes

None

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joshahubbers created an issue. See original summary.

joshahubbers’s picture

I added the patch to enable sound by default. It follows the device setting of course, so when sounds are muted a buzz is played, or nothing at all, depending on the user phone preference.

It could be a new parameter of the function, but this is the less intrusive way, I thought.

joshahubbers’s picture

Also fixed some pipeline-things. Only composer next minor fails. Don't know why exactly.

ptmkenny’s picture

Status: Active » Needs work

Hi, thanks for this MR. I think this is a good change but please submit a new MR that only has the fix for playing a sound; the pipeline stuff should be fixed in a separate issue.

ptmkenny’s picture

Title: Default messag does not play sound » Play notification sounds by default; add argument to allow silent notifications
ptmkenny’s picture

I'm going to add a new argument, $silent, to the API to enable people to get silent notifications if necessary.

ptmkenny changed the visibility of the branch 3529972-default-messag-does to hidden.

ptmkenny’s picture

ptmkenny’s picture

Status: Needs work » Needs review

@joshahubbers Ok, I created a new branch that adds a preference (default: sound on) to override the behavior. Please test it and let me know if it works for you.

ptmkenny’s picture

Version: 1.0.x-dev » 7.0.x-dev

  • ptmkenny committed 4b6d7aa4 on 7.0.x
    Issue #3529972 by joshahubbers, ptmkenny: Play notification sounds by...
ptmkenny’s picture

Status: Needs review » Fixed

Ok, I was able to get this all working on my setup, so I'm going to commit. To be honest, I never tested notifications with sound because I don't use them personally so I didn't realize this had to be added. It's fixed now though, many thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

joshahubbers’s picture

Hi PTMkenny, Sorry for my late response. I was on vacation. Thanx for committing it and making it a setting. Nice!

ptmkenny’s picture

Welcome back and I'm glad this solution works for you!