Skip to content

Android Widget crashes or fails to route on Cold Start #594

@chan9an

Description

@chan9an

Describe your issue

The Android widget currently breaks if the app is fully closed (swiped away from recents). It works fine if the app is just sitting in the background, but on a cold start, it fails in two ways:

  1. Android 12+ Crash: Clicking the widget causes a crash or a black screen. We're using PendingIntent.getBroadcast to open the app, and newer Android versions specifically block starting activities from background receivers like this.
  2. Routing Failure: Even if the app doesn't crash, it fails to route you to the right place on a cold start. Whether you click the "+" button or a specific task, it just opens the app to the default home screen. It never actually triggers the "Add Task" sheet or opens the task details like it's supposed to.

Steps to reproduce

  1. Add the Taskwarrior widget to your Android home screen.
  2. Force close the app completely (swipe it away from the recent apps list).
  3. Tap either the "+" (Add) button or any specific task on the widget.
  4. Observe the result: The app either crashes completely (showing a red Flutter error screen in debug mode / black screen in release) or it just opens the main screen and fails to route to the requested "Add Task" sheet or task details.

What was the expected result?

When the app is completely closed (cold start), clicking the widget should successfully open the app without crashing or showing a black screen. Specifically:

  • Clicking the "+" button on the widget should open the app and immediately show the "Add Task" bottom sheet.
  • Clicking a specific task on the widget should open the app and take you directly to that task's details.

Put here any screenshots or videos (optional)

The Bug - Fails to route/Crashes (App completely closed):
App completely closed

Working as expected (App running in background):
App in Background

How can we contact you (optional)

You can tag me right here on GitHub, or reach me on Zulip (User ID: 1017036).

Would you like to work on this issue?

Yes

By submitting this issue, I have confirmed that:

  • I have starred the repo ⭐ and watched 👀 it on GitHub and followed the contribution guidelines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions