Skip to content

Guard startForeground calls with try/catch and add isForeground flag - #11

Merged
Ludevv merged 1 commit into
ds-custom-forkfrom
fix-play-console-restricted-fgs-warning
Jun 10, 2026
Merged

Guard startForeground calls with try/catch and add isForeground flag#11
Ludevv merged 1 commit into
ds-custom-forkfrom
fix-play-console-restricted-fgs-warning

Conversation

@Ludevv

@Ludevv Ludevv commented Jun 10, 2026

Copy link
Copy Markdown

Problem

Google Play Console flags our production releases with a "Restricted foreground service types" warning, pointing at com.brentvatne.exoplayer.VideoPlaybackService.onStartCommand. Apps targeting Android 15+ cannot start mediaPlayback foreground services from BOOT_COMPLETED receivers, and Play's static analysis flags the unconditional startForeground() call as a potential crash path

Solution

  • Port the foreground-start guard from the v7 player service: the onStartCommand change is a copy of v7's isForeground flag + try/catch around the placeholder notification
  • Apply the same pattern to registerPlayer's startForeground() call - this call site only exists in the legacy service (v7 uses setMediaNotificationProvider instead)

cc: @sharnik @szymonkoper @mobily

@Ludevv
Ludevv merged commit 040793b into ds-custom-fork Jun 10, 2026
0 of 3 checks passed
@Ludevv
Ludevv deleted the fix-play-console-restricted-fgs-warning branch June 10, 2026 09:36
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.

2 participants