Closed link2xt closed 1 month ago
I tested on the phone with FCM services. Establishing a new connection is not a big problem, but status bar on Android shows "Not connected" and then "Connecting..." for a moment every time a notification arrives. This connectivity status change should definitely not happen.
When
accounts_background_fetch
was introduced, it was intended for iOS which does not run the application in background most of the time anyway, so when push notification arrives, there is no existing connection most of the time.With Android it depends on the phone. If it does not kill the application most of the time, it is unnecessary to kill existing connections as done here: https://github.com/deltachat/deltachat-core-rust/blob/486ea3a358b4cd0518de7e11f2997ea463a50604/src/context.rs#L529
As Android is going to start using
background_fetch
, it should be modified to better support the case when I/O is already started: https://github.com/deltachat/deltachat-android/pull/3312Background fetch should probably be moved to the scheduler. If I/O is currently stopped, run background fetch on a separate connection as we do now, but if I/O is already started, interrupt the inbox loop and wait for it to finish one cycle, then interrupt mvbox loop and wait for it to finish one cycle.