Skip to content
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

Option to disable permanent notification #82

Closed
Hocuri opened this issue Apr 30, 2017 · 51 comments
Closed

Option to disable permanent notification #82

Hocuri opened this issue Apr 30, 2017 · 51 comments

Comments

@Hocuri
Copy link
Collaborator

Hocuri commented Apr 30, 2017

I would like an option to disable this permanent notification ("Connected to a@b.c; waiting for messages ...") for the following reasons:

  1. If I am well informed, this will prevent the android system from stopping this app when it runs out of memory. Of course, this may be useful, but personally, I would like it better if all apps were treated equally.
  2. This notification is annoying me.

Nevertheless, this app is a great idea!

@kskarthik
Copy link

I also vote for this feature 📊

@r10s
Copy link
Member

r10s commented May 2, 2017

I also vote for this feature 👍

However, unfortuately, the permanent notification is technically needed:

As Delta Chat cannot and will not use Goog'e Clould Messaging (newspeach: Firebase Clound Messaging), we have to use Websockets - but recent Android versions kill all processes after some time; as a result, Delta Chat cannot show up reliable notifications for new messages.

The only exception from this are foreground services - and they always come together with a permanent notification.

Goog'e says that all this is to save battery ... IMHO it's more to push dev into using non-free-services; in my experience a mobile phone without Goog'e services nearly doubles the battery lifetime.

So, if you want to get rid of this notification, ask Goog'e for it.

Read on:
https://commonsware.com/blog/2015/06/03/random-musing-m-developer-preview-ugly-part-one.html
https://developer.android.com/preview/behavior-changes.html#back-all
Conversations has the same problem: https://twitter.com/iNPUTmice/status/844257001668513793 [via Heise-Forum (german site)]
Signal AFAIK has already a permanent foreground notification (but Signal uses Goog'e for notificatins by default)

@kskarthik
Copy link

Yeah, I dont have play services on my phone. I get a great battery life. Will look into these hacks

@kskarthik
Copy link

Looks like android is becoming an headache for devs...

@Hocuri
Copy link
Collaborator Author

Hocuri commented May 2, 2017

What about this idea:
If the user wants to, they can disable the notification in the settings. To get push messages, they have to install an extra app which replaces the Google Cloud Messaging service or wakes Delta chat up in intervals. It is no problem to allow the second app to use a permanent notification because the user can disable notifications for the extra app in the system settings and will still get notifications from Delta Chat. In the settings of the extra app the user can choose an interval in which to check for new messages.
I know this would not be a very nice solution because the user would have to install an extra app.

However, I still think that there should be an option to disable the permanent notification, in case the user uses a custom android.

@kskarthik
Copy link

Or should use alarm api ?

@r10s
Copy link
Member

r10s commented May 2, 2017

Using a second app is far too complicated for such a simple job - eg. the app showing the notification would required to hold the connection then.

But some little older Androids have a workaround: Eg. in "Stock Android M" (if I recall correctly) you can filter notifications away - you can hide the permanent notification but allow all other ones. AFAIK, this option is no longer present in Nougat... but maybe there are apps that allow this behaviour.

alarm api: do you mean this one? this does not help on this issue. In fact, there is no API for this job.

@kskarthik
Copy link

I'm on nougat. There's no such option.

@kskarthik
Copy link

What api does stock dialer & sms apps use to stay alive in background? I think they are restricted.

I remember Firefox os app devs using alarm api to enable background sync for their IM apps as a workaround due to lack of such feature.

@Hocuri
Copy link
Collaborator Author

Hocuri commented May 2, 2017

As far as I remember, you can filter notifications on Android 7 and above and older android versions do not kill the processes after some time.

If this is right you could just add an option to disable the permanent notification. Android 6 and below users would do that because there is no need for it.
And Android 7 and above users can simply hide the notification in the system settings.

@r10s
Copy link
Member

r10s commented May 2, 2017

Android Nougat has no longer a filter options (or I haven't found it).

And you're right, Android <= Lollipop would not need the permanent notification.

@Hocuri
Copy link
Collaborator Author

Hocuri commented May 20, 2017

On my Android 6 device if you go to
System settings -> Battery -> three vertical dots -> Battery optimisation
you can exclude apps from Battery optimisation (which is, as far as I know, just another name for "Doze").
Do you know if this could be an alternative for the ongoing notification?

If the user disables the notification, he could be told that he has to exclude "Delta Chat" from Battery optimisation. If he wants to, he could be redirected directly to the Battery optimisation activity:
com.android.settings.Settings$HighPowerApplicationsActivity

@licaon-kter
Copy link

licaon-kter commented Jun 10, 2017

Yes, please add an option to toggle this off.

Yes, some ROMs (eg. Huawei or Xiaomi) are too aggresive at killing the apps, but plenty others are not, exclude it in Doze and carry on.

You've mentioned Conversations, I've tested it (without GCM!) with Sony 5.1.1/6.0.1 and Samsung 5.0.2/6.0.1 and it always worked great without the need to force the foreground service (and the obligatory permanent notification).

BTW, speaking about IMAP, K9 works great without a notification too ;)

@Hocuri Hocuri mentioned this issue Jun 17, 2017
@r10s
Copy link
Member

r10s commented Jul 14, 2017

There is no option to this permanent notification. Sorry.

Signal has it, Riot has it, and others will get it as well.

But, at least, we'll add a little bit of functionality to it: #116

It may be possible under some circumstances to avoid it, however, currently we do not have the resources to check this out - and to test it, over and over, with every new Android version, Samsung may be different from LG etc. I think even if we'd had endless resources, we wont find anyone to handle this.

Please complain at Google about this issue.

@r10s r10s closed this as completed Jul 14, 2017
@licaon-kter
Copy link

licaon-kter commented Jul 14, 2017

Given that the UI is copied from Telegram (or did I understand wrong?) which has no such notification this is sad.

Not sure about GCM as a factor, Telegram/Conversations/Signal work without it anyway.

When did Signal get one? Don't remember seeing it, but it has been a while.

Anyway, Conversations solution is pretty ok since it shifts the burden to the user/ROM, if it works great, if not then blame Google/OEM. (have the notification ON, show a dialogue saying that if toggled off)

@r10s
Copy link
Member

r10s commented Jul 14, 2017

Telegram uses GCM and Signal also uses the permanent notification if GCM is not available. Delta Chat never uses GCM - this is a privacy feature! - and, if in doubt, always needs the permanent notification.

Any pull request with smarter approaches are welcome, I would be glad to review them and add them to master. But I fear there is simply no easy solution.

@r10s
Copy link
Member

r10s commented Jul 14, 2017

NB: The UI was initially based upon telegram (noy the best choice as we know today, however, there is only few originally code left), but this is no simple UI issue. It's the background service for which Google decides to display the permanent notification. No permanent notification=no repliable background service.

@ComptaShop
Copy link

Hello r10s, what do you think of setting DeltaChat as an accessibility service to get rid of this permanent notification ?

@licaon-kter
Copy link

@r10s
Copy link
Member

r10s commented Jul 26, 2017

I don't know. How can we achieve this? What would be the effect?

@ComptaShop
Copy link

Wow thank you for the link licaon-kter.

Nevermind r10s, this would be a major security issue.

For details my initial mind, Accessibility service is protect from system kill and restart when stopped, but a "bug" reset encryption password when this type of service is enable (by the user) ...

@r10s
Copy link
Member

r10s commented Jul 26, 2017

Okay, one more thing we know not to work. This is also an approach :)

Have a nice day,
Björn

@vitalyster
Copy link

vitalyster commented Nov 27, 2017

@r10s

never uses GCM - this is a privacy feature!

  1. You didn't trust Google and didn't want to send messages there? No problem, you can just send "You have N messages".
  2. You didn't trust Google's "serverless apps"? No problem, you can release plugins for popular opensource mail servers to support GCM/APNS (For example, there is already XAPPLEPUSHSERVICE IMAP extension and some opensource servers are support it)
  3. Opensource community may create own GCM self-hosted service alternative, shared between all opensource apps
  4. Stop using IMAP IDLE and do polling - it's easy and works in Doze mode

The problem solved with one of or combination of listed methods, but current state of Delta chat is unusable for most people, do you want to have casual users there, not only crazy techno nerds? :)

@STPKITT
Copy link

STPKITT commented Nov 27, 2017

What exactly makes you call it unusable?

@vitalyster
Copy link

@X-Ryl669
1.2. These are solutions for use with GCM and keeping privacy as much as possible, for non nerds.
3. MicroG is only client for GCM, I mean it is also possible to run self-hosted GCM server alternative. Of course it is for nerds.
4. This is the solution both for casuals and nerds:
a) 5-15 mins may be ok for many users, especially if
b) when application is in foreground (and user is actively chatting) it can enable IMAP IDLE and receive replies instantly, and switch to polling only when application is switched to background.

@vitalyster
Copy link

vitalyster commented Feb 14, 2018

Google locked us all to its GCM feature.

I didn't understand the whole point of hiding from Google on the Google phone. If me (and most of users) buy some device from Google or Apple then we are trust device vendor and want to use their services. Why deltachat force us to do these crazy things of hiding from Google? It can be configurable and me and only me should decide how I want to keep my "privacy", not the some nerdy app.

@r10s
Copy link
Member

r10s commented Feb 14, 2018

Why deltachat force us to do these crazy things of hiding from Google?

Thank you for your post. I do not think, Delta Chat forces users to do crazy things to hide from Google. It's just that plain IMAP does not work well with GCM, see #82 (comment) , and Google does no longer really offer a proper solution for this issue. To fix this, this may required crazy things.

Moreover, Delta Chat just does not want to rely and use Google Services to be compatible with phones not using Google (yes, they exist, maybe not many, but maybe a growing number if more apps stop relying completely on Google :).

@vitalyster
Copy link

plain IMAP does not work well with GCM

No, plain IMAP does not work well on mobile devices with limited battery/connectivity, it was designed to work on always-connected and always-on-power machines. GCM is the solution for keeping one background network connection for many applications on the device.

Delta Chat just does not want

You are blaming top 5 companies in the world for not allowing user to have options, and doing it the same way ;)
If user will be happy Delta Chat user on "Google-locked" device - then it can recommend it to friend, then it can see Delta Chat is not require Google services, and then and only then users can be free from "proprietary services". Now your policy is too strict(!) for users and Delta Chat is only limited to "crazy nerds".

phones not using Google

That is what I described about self-hosted server alternative. Growing number of apps will require that alternative to share single network connection or this attempt to "fight Google" will fail.

@X-Ryl669
Copy link

X-Ryl669 commented Feb 14, 2018

You can use signal or telegram then. Signal and Telegram both decided to use GCM when it's available. However, if you think it's a good idea that Google knows everything you're saying, it's not my case. Currently, I do recognize the amount (herculean) effort spent by Google to build a viable mobile internet device, but I still dislike the strings attached to that. I don't want Google to monitor my life and my connections. So, yes, I would like to have a solution that not using Google as MITM.

Please forgive the bad analogy, but if I buy a car from Toyota, I don't expect Toyota to know everywhere I go with it, or what I store in the trunk. Why would I accept this from my phone manufacturer ? What would you say if, everytime you had to go somewhere with your car, you had to call Toyota to get permission to do it (even if Toyota always grants you the permission) ?
Because that's exactly what google is doing with GCM.

To answer your last comment, think of a message like "Got accident. I'm locked in my car and it's burning". Do you really think 15mn latency is good enough in that case ?

The issue is not about the merging idea for "waking up a device". It's a good move. The bad move is to lock everything in a proprietary and closed system. Honestly, how hard would it be to let user set up the server to query for merged notifications ? A URL in a setting page that's all that's required, since the notification protocol is already documented.
The fact that this URL is buried in GApps and it's protected by cryptography is the evidence that Google wanted to lock this out.

By the way, IMAP's IDLE is proved to be optimal for mobile's device battery saving compared to GCM.

@vitalyster
Copy link

@X-Ryl669

yes, I would like to have a solution that not using Google as MITM.

You can disable GCM in settings when there will be such setting :)
Moreover, you can use the phone without Google Apps and smart app (as signal or telegram, you mentioned) can detect and enable its own keep-alive service (and Delta Chat already have it, using IMAP). Why these proprietary apps should be smarter than free Delta Chat app? ;)

15mn latency is good enough in that case ?

How many users require minimal latency? 1 or 0.5%? Why they move app to background then? Google does not close foreground network connections.

@X-Ryl669
Copy link

Bah, no I disagree.
Delta Chat's solution is not that nice compared to GCM. The initial excellent idea of GCM is to avoid repetitive wake up that drains battery. If all app on my phone starts using a foreground service, and they all wake up at random interval, the battery drain will be huge (on my phone, K9 drains 30% of the battery on average and I'm not using any polling). GCM / Doze idea is to batch the different wake-up to avoid such cases. With a foreground service, one has to be very careful about resource consumption (go sleeping as much as possible) and there is no communication between process to synchronize their actions, so it can only fail the more application start using this scheme.

I think the issue with latency is not about how many users, but how often you need low latency. You don't care to receive a "Ok, thanks" message 5mn later (or even one hour later), but in case some message is urgent, you want it now, not one hour later.
If the system can not do that, then it fails (at least for me, I will not use it as my main messaging app).
If you write this out "Beware this messaging app can have up to 15mn before you are notified about a new message", no one will use it. If you don't, you lie to your users (that's worse, IMHO).

@vitalyster
Copy link

If you write this out "Beware this messaging app can have up to 15mn before you are notified about a new message"

The same for now, Delta chat should have warning "We are draining your battery with our home-made GCM alternative service" and users will not use it.

It can be more user-friendly and provide options and description of advatanges and disadvantages of each, but the main problem for now is absence of any option.

@X-Ryl669
Copy link

That's true. If it was possible to use GCM then having the choice in user's hand would be good.
(And I'm sure a lot of people will use GCM here unfortunately, since it's a good technical solution with a bad political issue).
Yet depending on GCM prevent Deltachat from being included in F-Droid's repository and also is against the dev philosophy, as I understand it (I'm not a dev for this project, just a user like you...)

Now, taking the above into account and accepting that GCM is not (will not be?) in this project, how to have:

  1. Push notification
  2. Non painful UI (unlike currently)
  3. Low latency
  4. Low battery drain
  5. Privacy / Secrecy

is the current goal of this discussion/issue.

And for now, there is no better solution than GCM (except for point 5). If point 5 is not that important to you, there are other solution to this (look at Signal/Telegram/Conversation/Whatsapp). In this project, I think point 5 is one of the main selling pitch. The question of this issue, as I understand it, is about having point 2 done right even if point 4 is not optimal.

@vitalyster
Copy link

depending on GCM prevent Deltachat from being included in F-Droid's repository

Android build system provide so called "product flavors" which allowing to build single app with different dependencies. For example, https://conversations.im/ - have "playstore" and "free" flavors, and free flavor living in F-Droid, so it is not an issue.

@r10s r10s mentioned this issue Mar 10, 2018
@r10s
Copy link
Member

r10s commented Mar 10, 2018

It can be more user-friendly and provide options and description of advatanges and disadvantages of each, but the main problem for now is absence of any option.

I agree. Who can implement this? :) However, #269 suggests an option to decide between poll or push.

@kevincox
Copy link

With newer versions of android these notifications can now be hidden, unfortunately this hides all deltachat notifications. I think that putting these in a separate notification channel would allow blocking that category of notifications while still receiving chat notifications. Has anyone looked into this?

@r10s
Copy link
Member

r10s commented Mar 28, 2018

@kevincox i also saw some older ones, where you could disable this type explicitly, was in cyanogen, i do not remember which version.

apart from that: afaik no one has played with "notification channels" yet. i reopen this issue so that it gets more visible; though its #269 will also offer a partly solution.

@r10s r10s reopened this Mar 28, 2018
@testbird
Copy link

testbird commented Mar 30, 2018

See nextcloud/talk-android#58 (comment), hiding seems only to work in newest android version, or by separating the permanent notification into a push client package:

https://gitlab.com/foss-push/planning/
deltachat/deltachat-core#113.

@testbird
Copy link

testbird commented Mar 30, 2018

"We are draining your battery with our home-made GCM alternative service" and users will not use it."

Sorry, looks like there are postings trying to inject FUD.

I see DC on devices running in idle for days without noticeable battery drain.

If battery drain is observed, the problem is much more likely to be due to some remaining timing, reconnect, network change, or imap scanning issue.

An "instant messenger" with background notification delays of 15 minutes (anything beyond a minute actually) would seem more like a joke. (As if you could talk yourself out of the competition.)

@vitalyster
Copy link

vitalyster commented Mar 30, 2018

devices running in idle

Did you try to leave your home wifi station?

out of the competition.

You are competing with Google, right?

@testbird
Copy link

testbird commented Mar 30, 2018

Did you try to leave your home wifi station?

So you observed something, but posted about something else? What could be the cause for increased battery usage according to your problem analysis?

@vitalyster
Copy link

@testbird constant network changes causes increased battery usage. To minimize battery impact I have Google services which provides single network connection for all background activities, thousands of well-paid engineers are working on its optimization. Thousands of "instant messengers" are working great over Google services. Now you say "Google services are evil, we will keep another background connection". Yes, you can do it on the device without Google services, what about casual users?

@stefan-niedermann
Copy link

@vitalyster

And what about users who care about privacy and therefore do not use proprietairy google services?

Let's be honest: "casual users" use whatsapp.

Sorry, this should not sound offensive, but this is an important topic for a decentralized messenger with privacy focus, since google services are the exact opposite and depending on it woupd at leaste for me be a no-go.

@testbird
Copy link

testbird commented Mar 30, 2018

Yep, it's just that working for Apple Push Notifications and Google Cloud Messaging modules in open source apps may produce some monopoly aversion, and lead to detect the wrong causality and to working on alternatives.
https://github.com/vitalyster/mod_smacks_notifications

@vitalyster
Copy link

Let's be honest: "casual users" use whatsapp.

That is what I want at first: be honest and have big red warning in the app "this app in for nerds who doesn't want to use proprietary services". Or provide options for casual users as discussed earlier.

@testbird
Copy link

testbird commented Mar 30, 2018

Some difference lies between agitating, distorted reflexing ... vs. looking for solutions to some (claimed but not confirmed) higher battery usage.

@r10s
Copy link
Member

r10s commented May 22, 2018

The permanent notification is disabled by default now, see #269

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests