Skip to content

Stop background sync when network connection is lost #1920

@dontub

Description

@dontub

The F-Droid version of Element periodically tries to perform a background sync no matter whether a network connection is available or not. To reduce battery usage #536 the background sync should be stopped when no network connection is available. As far as I can see there are at least two ways to achieve this:

  1. Using a PeriodicWorkRequest with NetworkType.CONNECTED as constraint. https://developer.android.com/topic/libraries/architecture/workmanager/how-to/define-work Edit: A PeriodicWorkRequest cannot run more often then every 15 minutes.

  2. Using a ConnectivityManager.NetworkCallback to be informed when a network connection is available or a network connection is lost. https://developer.android.com/reference/android/net/ConnectivityManager.NetworkCallback

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions