diff --git a/FAQ.md b/FAQ.md index 858506382a..0297b84074 100644 --- a/FAQ.md +++ b/FAQ.md @@ -895,6 +895,9 @@ You could disable this option for example for the sent folder and the archive. Synchronizing messages at night is mostly not useful, so you can save on battery usage by not synchronizing at night. In the settings you can select a schedule for message synchronization (this is a pro feature). See also [this FAQ](#user-content-faq78). +Some providers don't follow the IMAP standard and don't keep connections open long enough, forcing FairEmail to reconnect often. +You can workaround this by lowering the keep-alive interval in the advanced account settings to for example 9 minutes. + If you got the message *This provider does not support push messages* while configuring an account, consider switching to a modern provider which supports push messages (IMAP IDLE) to reduce battery usage. diff --git a/app/src/main/java/eu/faircode/email/EmailProvider.java b/app/src/main/java/eu/faircode/email/EmailProvider.java index 63174c0d60..49ebb55312 100644 --- a/app/src/main/java/eu/faircode/email/EmailProvider.java +++ b/app/src/main/java/eu/faircode/email/EmailProvider.java @@ -50,6 +50,7 @@ import java.util.Locale; public class EmailProvider { public String name; public int order; + public int keepalive; public String link; public String type; public String imap_host; @@ -106,6 +107,7 @@ public class EmailProvider { provider = new EmailProvider(); provider.name = xml.getAttributeValue(null, "name"); provider.order = xml.getAttributeIntValue(null, "order", Integer.MAX_VALUE); + provider.keepalive = xml.getAttributeIntValue(null, "keepalive", 0); provider.link = xml.getAttributeValue(null, "link"); provider.type = xml.getAttributeValue(null, "type"); } else if ("imap".equals(name)) { diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index 5965e2dfe2..38d8d6bc26 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -253,6 +253,7 @@ public class FragmentAccount extends FragmentBase { etRealm.setText(null); etName.setText(position > 1 ? provider.name : null); + etInterval.setText(provider.keepalive > 0 ? Integer.toString(provider.keepalive) : null); grpFolders.setVisibility(View.GONE); btnSave.setVisibility(View.GONE); diff --git a/app/src/main/res/xml/providers.xml b/app/src/main/res/xml/providers.xml index 7db1c48e3b..d17e8d236c 100644 --- a/app/src/main/res/xml/providers.xml +++ b/app/src/main/res/xml/providers.xml @@ -115,6 +115,7 @@