Skip to content

FCE-3368: Android ForegroundService should take a importance flag#49

Merged
MiloszFilimowski merged 3 commits into
masterfrom
mfilimowski/FCE-3368-fix-foreground-service
May 27, 2026
Merged

FCE-3368: Android ForegroundService should take a importance flag#49
MiloszFilimowski merged 3 commits into
masterfrom
mfilimowski/FCE-3368-fix-foreground-service

Conversation

@MiloszFilimowski

Copy link
Copy Markdown
Collaborator

Description

  • Add optional importance?: 'low' | 'high' to ForegroundServiceConfig;
  • Native: WebRTCForegroundService maps the value to NotificationChannel importance and NotificationCompat priority via channelImportanceFor / builderPriorityFor
    helpers. Defaults to 'high' when omitted (current behavior).
  • Fix: tapping the notification now opens the host app's launcher activity. Previously the service Intent was passed to PendingIntent.getActivity(...), which had no
    activity component to resolve, so the tap silently did nothing.
  • Switched the launcher PendingIntent to FLAG_IMMUTABLE and added FLAG_ACTIVITY_SINGLE_TOP | FLAG_ACTIVITY_CLEAR_TOP so the existing task is reused instead of
    stacked.

Motivation and Context

The foreground-service notification was always loud (IMPORTANCE_HIGH) and tapping it did nothing - both made the background-call indicator unnecessarily intrusive and
broken. Exposing importance lets consumers opt into a silent ongoing-call style, and the launcher fix restores the expected "tap to return to the app"

Copilot AI review requested due to automatic review settings May 27, 2026 09:31
@linear

linear Bot commented May 27, 2026

Copy link
Copy Markdown

FCE-3368

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the React Native foreground-service API to allow callers to control notification “loudness” via an importance flag, and fixes Android notification taps so they reopen the host app instead of doing nothing.

Changes:

  • Added optional importance?: 'low' | 'high' to ForegroundServiceConfig and forwarded it to the native module.
  • Android foreground service now maps importance to NotificationChannel importance and NotificationCompat priority (defaulting to high).
  • Android notification tap now targets the app’s launcher activity via getLaunchIntentForPackage(...) with an immutable PendingIntent.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/useForegroundService.ts Adds importance to the JS/TS config and forwards it to native.
android/src/main/java/com/oney/WebRTCModule/foregroundService/WebRTCForegroundService.java Applies importance to notification priority/channel importance and fixes notification tap intent.
android/src/main/java/com/oney/WebRTCModule/foregroundService/ForegroundServiceController.java Reads importance from the RN config (default high) and passes it to the service intent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

@Magmusacy Magmusacy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me ☕

@MiloszFilimowski MiloszFilimowski merged commit dbd4fb0 into master May 27, 2026
8 checks passed
@MiloszFilimowski MiloszFilimowski deleted the mfilimowski/FCE-3368-fix-foreground-service branch May 27, 2026 10:24
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.

3 participants