forrestguice / SuntimesCalendars

A calendar provider add-on for Suntimes.
GNU General Public License v3.0
32 stars 11 forks source link

missing calendars/events when closing app while task is still running #4

Closed forrestguice closed 5 years ago

forrestguice commented 5 years ago

Closing the app while adding calendars kills the running task. The result is calendars that are incomplete or missing. A progress dialog was added to prevent this from happening accidentally. A dialog is better than no feedback at all, but it doesn't actually prevent the problem.

To reproduce... 1) Toggle calendars off 2) Toggle calendars on 3) Click Home (to browse away) -> Task List -> Clear 4) Watch the notification tray. The progress notification will stay open indefinitely since the task responsible for managing it was killed (and therefore unable to dismiss it). 5) Open the calendars app and inspect for missing events. Since the moon calendar is added first (and takes a pretty long time), its likely the solstice calendar is entirely missing.

forrestguice commented 5 years ago

Fixed by moving the task responsible for adding calendars into a bound service and changing the progress notification to use startForeground (transition to foreground service).