forrestguice / SuntimesCalendars

A calendar provider add-on for Suntimes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

forrestguice opened this issue · comments

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.

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).