Why can't Delta Chat use IMAP IDLE or "long polling" as a workaround on iOS for long notification delay

Dear Delta Chat Team,

this post is more a know-how question which I am interested to learn about, but of course I would also find it good if improvement might be possible.

I am using Delta Chat on a iPhone and I find it’s concept generally a great idea!
But the fact that while the app is not opened, new messages are only notified after a long time (sometime more than 20 minutes), leads me to still use other apps like Signal even with my communication partners with whom I have already exchanged my Delta Chat encryption key.

I have already studied the posts here in the forum, and it is often said like “apple is very restrictive with background processes”.

I understand this restriction on iOS for “real” push notifications.
But why is it technically not possible to use IMAP IDLE or “long polling” as a workaround, which is working for many other e-mail apps on iOS?
From the docu I have read this seems to be a platform independent technique.

When I receive a Delta Chat chat message on my iPhone, then my e-mail app Spark Mail almost immediately signals this new message, even when it is in background and not opened, while Delta Chat signals it only minutes later. Same for my Outlook app, this also nofifies me immediately. And both I am using with an independent e-mail provider, not iCloud or Microsoft.

Thank you very much in advance if somebody finds the time to explain this!!

Notifications sent via Apple Push Notification Service are not delayed, iOS keeps connection to APNS and delivers messages sent via APNS quickly. Delta Chat however cannot use APNS as this requires email server to support APNS and send notifications to the client via Apple.

Delta Chat for iOS is already using IMAP IDLE when the app is in foreground. However when the app is notified that it is going to be moved to inactive state via applicationWillResignActive it registers a background task and closes IMAP connection when there is less than 10 seconds remaining of background time according to backgroundTimeRemaining.

Which iOS email apps using IMAP IDLE are you aware of? Spark Mail is not using IMAP IDLE. It gives your email credentials to “Spark Services” which then watches your mailbox and notifies the app via APNS. This is stated in the privacy policy:

OAuth login or mail server credentials: Spark requires your credentials to log into your mail system in order to receive, search, compose and send email messages and other communication. Without such access, our Product will not be able to provide you with the necessary communication experience. In order for you to take full advantage of additional App and Service features, such as “send later”, “sync between devices” and where allowed by Apple – “push notifications” we use Spark Services. Without using these services, none of the features mentioned above will function.

Does the provider use IMAP or ActiveSync?

Thanks for your detailed explanations! This makes it now clear to me what the technical root problem is.

I must admit that I was not aware of the Spark Services involved. I often do not read the long long policies carefully before installing an app. This is now one additional reason for me to use Delta Chat instead as often as possible!

You are right of course regarding Outlook app (sorry, my mistake); my e-mail provider offers Open Xchange, so I can use EAS there.

how horrible the situation in iOS, most email clients there involve giving your email credentials to a 3rd party server that then have full access to your inbox and sends you push notifications.

I know this is not the solution for Delta Chat but at least as your personal solution if you care about privacy, you should consider moving away from iOS

There is ActiveSync and XAPPLEPUSHSERVICE extension which make it possible for providers to send notifications via APNS. But only some providers support these and email providers need an Apple developer account to do this, so it is very unlikely that we will prioritize supporting this in chatmail setup, deploying it on our CI server, testing Delta Chat against it and developing Delta Chat support for it.

As far as I understand it, XAPPLEPUSHSERVICE is just for the apple iOS mail app.
NEAppPushManager | Apple Developer Documentation looks more promising, but is only available for a limited amount of hardcoded LTE/WLAN network ids (private company/organisation networks)