From 0304f4ff2c7488d891e6d5f82c6c8184b7d17254 Mon Sep 17 00:00:00 2001 From: Xenofic Date: Wed, 27 May 2026 20:25:16 +0530 Subject: [PATCH] fix: allow microphone usage in media projection --- .../java/com/oney/WebRTCModule/MediaProjectionService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/oney/WebRTCModule/MediaProjectionService.java b/android/src/main/java/com/oney/WebRTCModule/MediaProjectionService.java index 26e188c45..d8413299a 100644 --- a/android/src/main/java/com/oney/WebRTCModule/MediaProjectionService.java +++ b/android/src/main/java/com/oney/WebRTCModule/MediaProjectionService.java @@ -72,7 +72,11 @@ public int onStartCommand(Intent intent, int flags, int startId) { Notification notification = MediaProjectionNotification.buildMediaProjectionNotification(this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION); + int serviceType = ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + serviceType |= ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE; + } + startForeground(NOTIFICATION_ID, notification, serviceType); } else { startForeground(NOTIFICATION_ID, notification); }