Show a permanent notification

a permanent notification is one of the few ways that may work to keep an app alive on android.

some users report that this type of notification would make getting messages in background more reliable and there are reports that this type of notification could also be an idea for Delta Chat (eg. here).

in fact, Delta Chat already uses this type of notification to keep the app alive - but we do this only for the time the screen is turned off :slight_smile: (at some point, users were annoyed by the permanent notification and this seemed to be a nice hack)

however, maybe things have changed since then and the permanent notifications are more widely used and can be regarded as a hint that “Things are working”, that “Delta is waiting for messages …”.

this disappearing permanent notification would also be a strong hint that the app has been killed by the system without consent.

what do you think? would you a permanent notification still annoy you? or may it be regarded more as a hint that things are “okay”?

1 Like

modern androids have options to hide these notifications, and also apps like Conversations and Telegram(from F-Droid) have a switch to enable/disable the notification so if it will be annoying for some users they can just opt out, but I think this feature will make happy several users that are having issues with their system killing Delta Chat and that is really a blocker for them

yip, a switch also came into my mind, but comes with new problems.

  • switches make support harder, one option more you have to keep in mind when targeting issues.

  • more important, a switch where users can opt-out to permanent notifications will make things even worse - users want to get rid of the notification, but they do not want to get rid of background task - this is why we try to hide the notification. it is not that clear for many users that this is related (of course, you can explain etc. but this requires the users reading and understanding weird things).

the second point could be mitigated by creating a switch between visible and hidden permanent notification. or switching off permanent notifications when “allow background” is enabled - but according to this does not really prevent systems from killing us. therefore a unconditional permanent notification may be a nice option overall, with more advantages than disadvantages.

btw, in general, i do not think, that Delta Chat has more problems as Conversations or TelegramWithoutGoogle, btw - all use a permanent notification to keep things alive and are killed under similar circumstances. of course, this is hard to debug.

1 Like

:o I have never seen an app with a permanent notification been killed, not even in my former low ram phone where I can only run one app at the time and when I minimize and change to another app the previous is killed, apps like termux were never killed thanks to the permanent notification,
in any case I think the permanent notification will be useful and has much more pros than cons
(so I think it is better to have it without option to disable it than not having it)

1 Like

wow, this sticking stuff can be switched off? thanks, will try it immediately
is it system setting, or each app has its own way to find?

If I’m reading all this there are coming up several questions:

  1. Is the permanent notification really a technical solution to get DC running reliable in background? If yes ok so far.
  2. The current approach to use a permanent notification, but switch it off when DC is in foreground seems to be an ideal approach. It should work in principle as reliable as 1. but it didn’t under some circumstances?!
  3. Do we have enough information (logs) to examine what DC does when it is not reliable?

If 1. is working, the notification would not be disturbing for me.
Quite the contrary: If the text of the notification is chosen well, it’s a good information that DC’s working as required.

But why the permanent notification is not working when it comes up in the moment the screen is switched off? Maybe we should try to find the root cause of this?
Do we need to extend/change logging possibilities?

Is DC capable to detect if it’s killed in background?
When yes, it could switch notification to really permanent when this “kill” is detected?

1 Like

not in all cases - if we detect it, we already just restart :slight_smile:

But if You detect killing DC and restart - wouldn’t it be a possibility then to switch the notification to really permanent to mitigate the situation?

Even more, You could inform user in device chat that this situation has been detected and what has been done afterwards.

1 Like

yip, a message in the device chat would be great, we also thought about that.

it seems to me the notification hiding mechanism is ideal in theory, but it does not cut it for unknown reasons in practice. i’m for the permanent notification display.
in the meanwhile we can try to figure out why the hiding mechanism is not cutting it in 5 out of seven cases ( counting my friends phones).

as a side note, i was thinking: why there is not a single “keepalive” app displaying its permanent notification and using all possible techniques to prevent its killing, that is providing a keepalive service (for example restarting) to every other app, which would register itself in the “keepalive” app, like conversations, deltachat,telegram, alarms,riot, etc… is this a doable approach in general? externalizing this functionality to an external app and thus have only one permanent notification and not one for each app. It might be easier to collaborate on it with other projects as well, and get all state of the art of “keepalive” in one place.

1 Like

bjørn wrote:

the second point could be mitigated by creating a switch between
visible and hidden permanent notification

csb0730 wrote:

But if You detect killing DC and restart - wouldn’t it be a
possibility then to switch the notification to really permanent to
mitigate the situation?

I think that this would be a great option to have. The permanently
visible notification would be an obvious indicator to check whether DC
has been killed or not. That’d allow users to enable it when they
suspect that DC is being killed when they don’t mean that to happen.

Even more, You could inform user in device chat that this situation
has been detected and what has been done afterwards.

I think that that would just result in users getting messages about
stuff they do not understand nor can do anything about. That could end
up being annoying. A “enable permanently visible notification” switch
would be more subtle and to produce more information there’s always the
log right?


Reference my opinion in GitHub:

@r10s and all devs:
have you considered the same approach:

We leveraged Android Job mechanism to launch our service periodically (at least every 15 minutes), and we also try to keep it alive afterwards. We don’t hold WakeLocks manually – the system does this for us. We were able to ditch persistent notifications altogether.
–How Tutanota replaced Google’s FCM with their own notification system | F-Droid - Free and Open Source Android App Repository

1 Like

there is a pr that shows the permanent notification unconditionally:

1 Like

Hi hugot,

yes log is there but it’s so flooded by messages that a common user is not able to see what he’s searching for.
Even for me it’s not fully clear what I should search for to detect app is killed by system.

As this issue here is so important for many users there should be a clear indicator for every user if app is running reliable or not (uptime?).

@pproj what tutanota describes in the post is basically the same what Delta Chat doing - the post is 2 years old, so i am pretty sure, depending on the operating system, the described approach also has issues meanwhile.

Ok, thanks for the clarification, i wonder how they do it nowadays.