diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt index b519aabb8..a8851b0bd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt @@ -163,6 +163,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { super.onDestroy() if (!isChangingConfigurations) { EventsDatabase.destroyInstance() + stopCalDAVUpdateListener() } } @@ -290,6 +291,15 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { } } + private fun stopCalDAVUpdateListener() { + if (isNougatPlus()) { + if (!config.caldavSync) { + val updateListener = CalDAVUpdateListener() + updateListener.cancelJob(applicationContext) + } + } + } + @SuppressLint("NewApi") private fun checkShortcuts() { val appIconColor = config.appIconColor