-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Microphone does not work when switching to other applications during a call #160
Comments
Interesting, I do not know how to fix this. |
Samsung? Please try to add this to manifest: android:foregroundServiceType="camera|microphone" |
@iddq that might work. I have added it without being able to test it for now. |
So I have two Android 13 devices, Samsung and Xiaomi. I also experience the above problem, but only on Samsung. https://developer.android.com/about/versions/11/privacy/foreground-services |
I tested the latest code and it crashed. logsjava.lang.RuntimeException: Unable to start service d.d.meshenger.MainService@6a6479 with Intent { act=START_FOREGROUND_ACTION cmp=d.d.meshenger/.MainService }: java.lang.SecurityException: Starting FGS with type microphone callerApp=ProcessRecord{880c753 8467:d.d.meshenger/u0a430} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_MICROPHONE] any of the permissions allOf=false [android.permission.CAPTURE_AUDIO_HOTWORD, android.permission.CAPTURE_AUDIO_OUTPUT, android.permission.CAPTURE_MEDIA_OUTPUT, android.permission.CAPTURE_TUNER_AUDIO_INPUT, android.permission.CAPTURE_VOICE_COMMUNICATION_OUTPUT, android.permission.RECORD_AUDIO] and the app must be in the eligible state/exemptions to access the foreground only permission
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5046)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2418)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:224)
at android.os.Looper.loop(Looper.java:318)
at android.app.ActivityThread.main(ActivityThread.java:8671)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
Caused by: java.lang.SecurityException: Starting FGS with type microphone callerApp=ProcessRecord{880c753 8467:d.d.meshenger/u0a430} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_MICROPHONE] any of the permissions allOf=false [android.permission.CAPTURE_AUDIO_HOTWORD, android.permission.CAPTURE_AUDIO_OUTPUT, android.permission.CAPTURE_MEDIA_OUTPUT, android.permission.CAPTURE_TUNER_AUDIO_INPUT, android.permission.CAPTURE_VOICE_COMMUNICATION_OUTPUT, android.permission.RECORD_AUDIO] and the app must be in the eligible state/exemptions to access the foreground only permission
at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
at android.os.Parcel.createException(Parcel.java:3041)
at android.os.Parcel.readException(Parcel.java:3024)
at android.os.Parcel.readException(Parcel.java:2966)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7269)
at android.app.Service.startForeground(Service.java:862)
at d.d.meshenger.MainService.onStartCommand(MainService.kt:190)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5028)
... 9 more
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActiveServices.validateForegroundServiceType(ActiveServices.java:2807)
at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:2518)
at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1809)
at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:14032)
at android.app.IActivityManager$Stub.onTransact$setServiceForeground$(IActivityManager.java:12675) |
I am able to reproduce the error now. |
tested on samsung android 13 and it is working now. |
i can reproduce the crash for Android 14. I think the foreground service type is not accurate. The service is not meant to record audio or to use the camera. That would be the job of the CallAcivity. |
Does this error occur during a video call? I only use it with audio. How to reproduce the issue? |
Crash on startup, only on Android 14. |
The error message clearly states that in addition to the FOREGROUND_SERVICE_MICROPHONE permission, other permissions such as RECORD_AUDIO are also required. At runtime, you need to check for the presence of the RECORD_AUDIO permission and request it from the user if necessary. |
hm, I do not have much time atm. to debug this and provide a solution. Let's hope we can get this fixed in the next release. |
In Android 14, there is no permission to record audio in the background, and meshenger switching to the background can't record. But the camera can work fine in the background.
The text was updated successfully, but these errors were encountered: