Skip to content

Commit 5e75416

Browse files
committed
docs(signaling): tighten remoteMessaging comments — positive rationale only
1 parent 35a8639 commit 5e75416

2 files changed

Lines changed: 12 additions & 39 deletions

File tree

packages/webtrit_signaling_service/webtrit_signaling_service_android/android/src/main/AndroidManifest.xml

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,16 @@
99

1010
<application>
1111
<!--
12-
foregroundServiceType="remoteMessaging" is the correct type for SignalingForegroundService.
12+
SignalingForegroundService uses foregroundServiceType="remoteMessaging".
1313
14-
This service maintains a persistent WebSocket connection to the WebTrit signaling server
15-
to send and receive call-signaling messages (SDP offers/answers, ICE candidates, call
16-
state events). It never accesses the microphone, camera, or location — it is purely a
17-
messaging transport layer that runs before, during, and after a call.
18-
19-
Why NOT phoneCall:
20-
The phoneCall type is reserved for services that actively manage a call via the Android
21-
Telecom API (audio focus, in-call UI, connection state). That responsibility belongs to
22-
webtrit_callkeep running in the callkeep_core process via PhoneConnectionService.
23-
SignalingForegroundService sits below that layer: it delivers the signaling payloads
24-
that allow the Telecom layer to set up and tear down calls, but it does not manage
25-
calls itself. Using phoneCall here would require MANAGE_OWN_CALLS or default-dialer
26-
privileges and would be semantically incorrect.
27-
28-
Why NOT microphone / camera:
29-
This service does not capture any media. WebRTC media is handled by a separate
30-
component (flutter-webrtc) that runs in the main app process.
31-
32-
Why NOT dataSync:
33-
dataSync is for periodic background sync tasks. This service holds a continuous
34-
real-time connection — not a periodic one.
35-
36-
Android documentation for remoteMessaging:
37-
"Use this type if the app needs to be kept running on-device so that a remote
38-
service can send messages to the device."
39-
This matches exactly: the WebSocket is kept alive so the signaling server can push
40-
call events to the device at any time, without relying solely on FCM.
14+
This service maintains a persistent WebSocket connection to the WebTrit signaling
15+
server to exchange call-signaling messages (SDP, ICE candidates, call state events).
16+
The remoteMessaging type is defined by Android as the appropriate type for services
17+
that keep a long-running connection alive so a remote server can deliver messages to
18+
the device at any time — which is exactly what this service does.
4119
4220
Required permission: FOREGROUND_SERVICE_REMOTE_MESSAGING (declared above).
43-
Applies on Android 14+ (API 34, UPSIDE_DOWN_CAKE); older versions use type=0.
21+
Applies on Android 14+ (API 34+); older versions pass type=0.
4422
-->
4523
<service
4624
android:name=".SignalingForegroundService"

packages/webtrit_signaling_service/webtrit_signaling_service_android/android/src/main/kotlin/com/webtrit/signaling_service/SignalingForegroundService.kt

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,11 @@ class SignalingForegroundService : Service() {
135135
.setPriority(NotificationCompat.PRIORITY_LOW)
136136
.build()
137137

138-
// FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING is the correct type for this service.
139-
// It maintains a persistent WebSocket to the WebTrit signaling server and never
140-
// accesses microphone, camera, or location.
141-
//
142-
// phoneCall type is not appropriate here: call management via the Telecom API
143-
// (audio focus, in-call UI) is handled by webtrit_callkeep in the callkeep_core
144-
// process. This service is the transport layer below the call.
145-
//
146-
// Type is only declared on API 34+ (Android 14 / UPSIDE_DOWN_CAKE); on older
147-
// versions the OS does not enforce a type so 0 is passed.
138+
// FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING: this service maintains a persistent
139+
// WebSocket to the WebTrit signaling server so it can receive call-signaling
140+
// messages (SDP, ICE candidates, call events) at any time. The remoteMessaging
141+
// type is the Android-defined category for exactly this use case.
142+
// Declared on API 34+ only; older versions do not enforce a type.
148143
ServiceCompat.startForeground(
149144
this,
150145
NOTIFICATION_ID,

0 commit comments

Comments
 (0)