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
Doze and App Standby whitelist #1624
Comments
I'm having problems as well but I'm still not convinced doze is my problem. The session established time is often set to "just now" when I check that Is there any logging of when phone was dozing?
|
In my case this was caused by App Standby. Shouldn't happen while charging, but unlike Doze the device can be moving/in use. You can check by looking under Developer options -> Inactive apps (last entry on my phone) before you bring the app to the foreground by opening it. If it says "Inactive", then App Standby is in effect. I disabled battery optimization of Conversations (enabling the foreground service should work as well) and so it is now always "Active".
In Unfortunately, even on the whitelist, it looks like Doze eventually breaks the connection after ~7 hours (depending on ping interval). From
According to Doze whitelist documentation:
So it looks like Doze breaks We can instead use setAndAllowWhileIdle, but that cannot fire more than once per 15 minutes per app during Doze. |
Same issue on CM12.1, after turning off the screen, messages are not received and sender may get an error. It seems somehow the issue only occurs on WiFi (or at least it does not occur so quick when on phone network) At the same time, K-9 Mail does not seem to have any connectivity issues with IMAP Idle messages at all. Is there a way to make Conversations to behave more like K-9 mail (i.e. somehow ensure that it stays connected but don't show the icon in the notifications?) |
False alarm :-) it seems there is a connectivity issue as soon as I use IPv6 and K9-Mail seems to always use the IPv4 address. |
In case someone has similar issues to the ones I saw (sorry to paste so much here that does not have to do with the original issue): Samsung phones seem to block ALL IPv6 traffic as soon as the screen is turned off.. Maybe we could have an option to disable IPv6 connections in conversations? (unfortunately Android does not have an option to disable IPv6 in WiFi) |
@github-k8n Please open a separate issue or discuss this in the Conversations chat room. It's not appropriate to hijack this issue. It's also unfortunate that Conversations does not notice that it's disconnected after returning from app standby, after more half an hour in active Conversations still disconnected so I assume it will won't reconnect until Conversations is opened. Solutions? Force foreground service for devices on Android 6This does not help for doze mode and always keeps an ugly notification visible in the notification list. Ask for permission disable battery optimisation for devices on Android 6This works for both doze and app standby. Timer wakeup?From app standby there must be some other way to wake up, like the calendar notifies of new appointments. This won't help for doze mode however. Implement push XEP-0357I suppose it's a lot of work, but this might be the final solution anyway? |
I'm working on that. Might even make it to 1.9.0
yes that is the solution. However in case push is not available (not play store version or old server) we will still have to ask to disable battery optimizations
Thats the big question. For now I'm displaying a warning in the account details. But users might not go there very often. So we should probably just trigger the dialog once! from the conversations overview. |
Chiming in here to note that Chinese users cannot use GCM because Google servers are blocked in China. Most phones sold in China don't even have Google Play Services. Using XEP-0357 exclusively would mean that Chinese users cannot receive push notifications; that's especially bad since I've been recommending this app to my Chinese friends due to the strong encryption to protect against the draconian Internet surveillance. |
XEP-0357 does not depend on GCM, the server does the push-ing. |
It still refers to a "push service", which I assume means GCM/APNS etc? |
Umm, no, |
Well, through GCM etc... |
GCM is an option, but that depends on the server I guess. |
Of course, but the point of XEP-0357 is to integrate XMPP with things like GCM. Without GCM, App Standby would still break Conversations regardless of what other push provider is cooked up to use with XEP-0357. So I think it's irrelevant if we decide that GCM isn't going to be used anyway. |
@quantum1423 Well what do you propose then? If people in China (or wherever) can't use "things like GCM" (which I take to mean general-purpose push services), there's literally nothing you can do about that. There is no alternative technical solution. Those users will still always be able to white-list Conversations in their Android Doze settings. They may lose out on some of the battery savings, but otherwise won't be affected, so as far as I'm concerned, this is not really an issue. If you wish to discuss this further, feel free to join our MUC at |
Both push and whitelisting are available now |
We may want trigger a dialog to be added to the exemption whitelist for battery optimization on Android 6+ (ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS). This is an acceptable use case because we can not use GCM. See Optimizing for Doze and App Standby (aka deep sleep).
I did some brief testing with adb. During Doze (device idle), Conversations goes quiet (no logcat messages, no notifications), until the device is unlocked (moving or turning on the screen should work, but didn't seem to be enough for me). Not sure if the maintenance window works. During App Standby (app inactive), Conversations goes quiet until it is brought to the foreground. Presumably the server will eventually notice and destroy the session.
I'm running Android 6.0.1 on a Nexus 6P. I've manually disabled battery optimization of Conversations under Settings -> Battery -> Battery optimization. However, if you don't mind Doze, I think you can enable the foreground service setting to allow Doze but not App Standby.
Thoughts? Do others have similar problems with marshmallow?
The text was updated successfully, but these errors were encountered: