-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No sound for push notifications on iOS #107
Comments
It indeed looks like we're ignoring the "sound" tweak when sending notifications to APNS. |
I think using "default" is the better option here, as it matches the official apple docs. If the user wants to define a custom ring tone, it would be forwarded by the matrix home server in the tweaks object anyway. |
Yeah I'd tend to agree with you. |
We probably want input from the Riot iOS gang too, @manuroe ? |
I gather riot-iOS no longer cares about the The |
Hi, I am building a custom matrix client. When the app is terminated, APNS doesn't wake up the app to call some kind of a callback, it simply shows the remote notification with the information available in the message itself (like title, body, sound, etc.). I think, a callback method is only called when the app is started again by the user. Actually, I'm not an iOS developer, so my understanding might be not 100% correct. I had a look at the Riot implementation (including matrix ios kit), but I didn't find the place for the case when the app is terminated, which is the problematic case I'm dealing with. Thus, I can't think of a way how Riot can fetch the event when the app ist terminated. But still, Riot somehow displays push notifications (with sound and content) even when the app is terminated, which leads me to the assumption that they use a customized version of Sygnal. I've considered the apnspushkin to be the general APNS-based implementation. Otherwise this would mean that Sygnal offers no general implementation for APNS-based push notifications for client apps other than Riot? |
ok, it's sounding to me that this is a bug which should be fixed. PRs welcome, I guess :) @devjeff it's not entirely clear whether apnspushkin should be considered as riot-specific or not; you should see #128 if you have not already.
Riot-iOS uses the instance of sygnal on matrix.org, which, at the time of writing, is 0.7.0. It is not a customised version. |
I'm not sure about the validity of this issue (or perhaps what specifically is wrong). Sygnal's current position is that it is useful for sending data messages (as they are called in GCM, but APNs has an equivalent). The client app is the only one truly in a position to know whether the push is relevant and whether an action needs to be triggered, because encrypted events make this problem generally impossible for the server to solve. (If an app comes along which for some reason can ensure it never needs encrypted events, that might be a reason to allow Sygnal to send Notification messages too, which can show up on the phone with no app processing.) The current flow is that you probably should make your Sygnal set the content-available flag (using the default payload system, which is relatively recent) and your app in turn can then (as far as I understand) perform processing (download & decrypt events, running push rules). You may need to also set the mutable content flag so your iOS app can mutate the notification…. I'm afraid I'm no iOS dev so I've tried to piece together pieces of the docs but have no hands-on experience. If you wouldn't mind, please would you be able to write back about whether any of that works for you? I'm trying to improve Sygnal documentation in general; as you may notice above, Sygnal is very Element (Riot) flavoured but we would like to open it up where we can (and at least document the flavours so others have an easier time copying!). |
Hey, thanks for your detailed reply. The "content-available" and "mutable-content" flags are a good option. I wasn't aware of these flags, but "content-available" sounds exactly like what I was looking for. It can relaunch the application for 30 seconds in the background even if it is terminated, so that the app can perform some logic directly after the notification was received. However. The sygnal pushkin implementation has to be adapted to also send these flags, so that this can work. And from my understanding the default apnspushkin implementation doesn't do this. So the question still holds: How Riot (Element) can show message content and play a notification sound (if the app is terminated) if it doesn't use a customized implementation of Sygnal? I think, it shoul really made clear, whether the apnspushkin is an official implementation that is supposed to support all the desired use cases or whether it is more like a template that can be customized for the indiviudal needs. |
The basic idea is that you need to use https://github.com/matrix-org/sygnal#pusher-data-configuration which has the ability to tell Sygnal that you want to receive content-available and mutable-content flags. I apologise for the poor 'documentation', but I believe this test demonstrates what you need to do: Lines 33 to 38 in 77338ee
Send a I'll put this on my list of things that can use better documentation :). (We'd like for the pushkins to be generally usable for 'typical' use cases for any app, so to that end I will put in documentation and hopefully any sensible changes going towards that that.) |
All right, I think, now I finally understand. It is possible to define the desired apns fields directly at the pusher creation on the homeserver. I was missing reasonable examples for this, as the official matrix documentation only mentioned the url and format fields in the data dictionary. Thanks very much for your explanation. I'll try this configuration next week. I think, adding an example payload to the documentation would be a good idea. |
I think this has been resolved by documentation (#150), which will reasonably have to do for now. |
The "apnspushkin" class never sends the "sound" attribute in the notification payload (s. Push notification docs). Thus, the iOS device doesn't play a sound when the push notification is received.
From my understanding the "apnspushkin" should read the tweaks information from the device object (notifications.py), but this seems to be ignored completely. Still, I don't understand how the Riot.im iOS app manages to play a sound for incoming push notifications. Maybe a customized version of Sygnal is used?
The text was updated successfully, but these errors were encountered: