Skip to content

Android : Foreground Service gets killed ? #85

Description

@harryandroiddev

When foreground mode is enabled, the application starts a foreground service successfully and the service works correctly while the app is open or running in background.

However:

When the user closes the app (removes it from recent apps / swipes it away), the foreground service is automatically killed by the system, even though it should continue running.

Expected Behaviour

According to Android foreground service behavior:

  • A foreground service should continue running independently of the app UI.
  • Closing the app activity should NOT stop the foreground service.
  • The service should remain alive as long as:
    startForeground() is active
  • foreground notification is visible

Device Tested on : POCO S5 pro Android 15

Is there an way to start the foreground mode by default .

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions