Skip to content

Conversation

@RohitKushvaha01
Copy link
Member

@RohitKushvaha01 RohitKushvaha01 commented Dec 17, 2025

This PR introduces a new background executor, making it possible to run executors without starting a foreground service or showing a notification.

By default, executors continue to run in foreground mode (unchanged behavior). The new background executor allows running tasks in background mode.

New Background Executor

// Foreground executor (default – runs as a foreground service with notification)
Executor.start('sh', callback);

// Background executor (runs without a foreground service or notification)
Executor.BackgroundExecutor.start('sh', callback);



New apis for the default Executor

⚠️ Note:
When running in background mode, the service has a higher chance of being killed by the system after the app exits.

Service Behavior

  • The executor service is shared across all Executor instances.
  • Switching between foreground and background affects all active executors.
  • If the service is not running, starting either executor will launch it automatically.

Related APIs (secondary)

Two internal APIs are added to move the shared service between foreground and background modes:

  • Executor.moveToBackground()
  • Executor.moveToForeground()

Closes #1666

@RohitKushvaha01 RohitKushvaha01 marked this pull request as draft December 17, 2025 10:48
@RohitKushvaha01 RohitKushvaha01 self-assigned this Dec 17, 2025
@RohitKushvaha01 RohitKushvaha01 marked this pull request as ready for review December 20, 2025 09:35
@RohitKushvaha01 RohitKushvaha01 merged commit 4b1a6ba into Acode-Foundation:main Dec 22, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow running executor in background

1 participant