cybex-dev / twilio_voice

Flutter Twilio Voice Plugin
https://twilio-voice-web.web.app/
MIT License
39 stars 78 forks source link

Android app crashes when an Incoming Call is answered with java.lang.SecurityException: Requires the RECORD_AUDIO permission #243

Closed agent515 closed 1 week ago

agent515 commented 1 week ago

Issue Summary

Android app crashes when an Incoming Call is answered.

Steps to Reproduce

  1. A call is received on Android via Twilio
  2. System Call Notification is invoked
  3. We also have Answer and Hang Up button in the App itself
  4. App crashes when a call is answered via System Call or by calling TwilioVoicePlatform.call.answer()
  5. Log is attached below

Any other relevant information. For example, why do you consider this a bug and what did you expect to happen instead?

D/SessionLifecycleService(31440): Activity backgrounding at 231664262
I/TelecomFramework(31440): TVConnectionService: answer TC@17_1: (ICA.aC->CSFM.rF)->CS.an->H.CS.an(cgad/cast)@E-INk
2
D/VoipCallInviteConnection(31440): onAnswer: onAnswer
D/AndroidRuntime(31440): Shutting down VM
E/AndroidRuntime(31440): FATAL EXCEPTION: main
E/AndroidRuntime(31440): Process: com.privacybee.buzz.app, PID: 31440
E/AndroidRuntime(31440): java.lang.SecurityException: Requires the RECORD_AUDIO permission
E/AndroidRuntime(31440):    at com.twilio.voice.CallInvite.accept(CallInvite.java:704)
E/AndroidRuntime(31440):    at com.twilio.voice.CallInvite.accept(CallInvite.java:426)
E/AndroidRuntime(31440):    at com.twilio.voice.CallInvite.accept(CallInvite.java:633)
E/AndroidRuntime(31440):    at com.twilio.twilio_voice.service.TVCallInviteConnection.onAnswer(TVConnection.kt:50)
E/AndroidRuntime(31440):    at android.telecom.ConnectionService.answer(ConnectionService.java:2570)
E/AndroidRuntime(31440):    at android.telecom.ConnectionService.-$$Nest$manswer(Unknown Source:0)
E/AndroidRuntime(31440):    at android.telecom.ConnectionService$2.handleMessage(ConnectionService.java:1413)
E/AndroidRuntime(31440):    at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(31440):    at android.os.Looper.loopOnce(Looper.java:232)
E/AndroidRuntime(31440):    at android.os.Looper.loop(Looper.java:317)
E/AndroidRuntime(31440):    at android.app.ActivityThread.main(ActivityThread.java:8592)
E/AndroidRuntime(31440):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(31440):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
E/AndroidRuntime(31440):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
W/Sensors (31440): Cannot get virtualdevice_native service

Tested on both Android Emulator and Pixel 7. Didn't test on iOS.

soapthepro commented 1 week ago

@agent515 Try adding this to your AndroidManifest?

<uses-permission android:name="android.permission.RECORD_AUDIO"/>

agent515 commented 1 week ago

@soapthepro it's already been added.

soapthepro commented 1 week ago

@agent515 Did you allow microphone access while launching your application? Maybe try uninstalling it from emulator and building it again, or maybe manually enabling microphone permission from settings?

agent515 commented 1 week ago

@soapthepro that was it, thanks!