Context
With the Arrival of Element X the new version of element for Android, users will need to have push notification configured correctly. For user which use Element X from Google play most of time it will work by default by using the google service for this. But for degooglised Android phone the question is generally be more complex. It’s why I wrote this tutorial to explain the context of this and the different possibility to setup a correct notification system.
Notification provider
There are several notification provider that we can use on Android. On this tutorial we will focus on ntfy which is one of the provider. This require to have the ntfy application installed on your phone and also a ntfy server. You can use the official ntfy server or self host the ntfy Yunohost application. Self hosting ntfy is the most complex setup and I’ll focus on this option.
Setup
Synapse configuration
You will need to configure synapse to allow to send request locally to ntfy. For this you can do it from the config panel in: “Advanced Settings” > “Security”. And then enable the parameter: “Allow synapse to send request to localhost”.
Ntfy setup
Firstly you will need to install the ntfy application if it’s not already done.
Then you will need to create an account for each users. You can do this by this command:
sudo -u ntfy /var/www/ntfy/ntfy.sh user add <username>
Then you will need to configure the Android app to use your ntfy server and use the user that you created previously. You can do this from the ntfy app settings in the “General” section.
You will also need to create a dedicated subject into your Android app for the Element notifications. For this the most simple solution would be to launch notification diagnosis into Element X settings. It will create a new notification subject if it’s not already created. You can do this from Element X, in the settings in > Notifications > troubleshooting notifications > run the tests.
After that you should have a last one topic into ntfy (in the Android app). For each topic linked to your self hosted server you will need to configure the rights with theses 2 commands:
# Allow the user to read/write notification
sudo -u ntfy /var/www/ntfy/ntfy.sh access <user> <topic> rw
# Allow everybody to write (needed by synapse to push notifications
sudo -u ntfy /var/www/ntfy/ntfy.sh access everyone <topic> write
# Optional, check all rights
sudo -u ntfy /var/www/ntfy/ntfy.sh access
After that you can run again the test notification from element X and everything should work.
Side note
It could happen that some others app add some new additional topic later. It was by example the case on my side with Tusky. In this case you might have some notification issue because ntfy will have some issue with the new registered topic which has not the right configured. In this case you will just need to configure for the new topic the right as described above. Just keep in mind that this could happen.
Side not for /e/ OS users
By default /e/ OS already integrate the ntfy application so you won’t need to install any additional apps. But the apps is hidden so it need some trick to configure it.
Firstly you will need to enable UnifiedPush (if not already done). For this, open the system settings > System > UnifiedPush. And then enable the button “Enable the distributor”.
At some point you will also need to open the ntfy app. Currently there are no way to open this directly from the UI so there are 2 solution that I found for this.
Use the activity manager application to create a new button
The most recommended solution would be to install the activity manager application. With this application you can create any new shortcut to open a lot of activity. With this application you can find the ntfy application (foundation.e.ntfy
) and create a new shortcut to open the main activity from the main screen.
Open with ADB
An other solution would be to use ADB as described into this blog post. So just you just need to run this:
adb shell am start -n foundation.e.ntfy/io.heckel.ntfy.ui.MainActivity
And this will open the ntfy app provided by /e/ OS