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); }