androidx / androidx/media

ForegroundServiceDidNotStartInTimeException in PlaybackService when using Media3 MediaSessionService

Open
#2,412 5 comments 0 reactions 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since May 12, 2025.

bug: device specific question
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

The app crashes on Transsion - Unisoc Itel P40 devices android version 12 with a ForegroundServiceDidNotStartInTimeException in the PlaybackService, which extends Media3’s MediaSessionService. This occurs because the service fails to call startForeground() quickly enough after being started via startForegroundService(). Media3’s MediaSessionService automatically manages some foreground lifecycle steps, but delays in overriding critical methods (like onCreate() or onStartCommand()) can prevent timely startForeground() calls. This crash is isolated to Itel P40 devices, suggesting platform-specific quirks in handling foreground service timeouts.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.