twilio / voice-quickstart-android

Quickstart app for the Voice Android SDK
https://www.twilio.com/docs/api/voice-sdk/android/getting-started
MIT License
184 stars 140 forks source link

[Android 12] receiving a call while the app is killed, your voice cannot be heard #502

Closed rakefetWorkiz closed 2 years ago

rakefetWorkiz commented 2 years ago

Description

When the app is killed, and an event comes with an incoming call - The activity starts properly like it should, it plays the ringtone like it should, but when you answer the call - the user (using the app, with Twilio SDK) is not heard on the other side.

This issue is not happening if the app was in foreground when the call came in.

Checking on the logs, this issue appears:

BackgroundServiceStartNotAllowedException Not allowed to start service Intent { act=ACTION_INCOMING_CALL cmp=com.workiz/.RNTwilio.IncomingCallNotificationService (has extras) }: app is in background

Tho - the activity did start, and the user was able to connect to the call, and is able to hear the other side of the call. so it is just the microphone side - which of course has permissions.

Steps to Reproduce

  1. Start the app and register for incoming calls
  2. Kill the app
  3. Receive an incoming call
  4. Try talking the person in the other side of the call

Code

I don't know which code is relevant to this issue, we got a lot of code that may be related, if you'll ask for specific snippet - I'll be happy to provide 🙏

Expected Behavior

Both sides of the call will hear each other, with no regards to the app status

Actual Behavior

The user from the side of Twilio SDK is not being heard on the other side.

Reproduces How Often

Always

Twilio Call SID(s)

CA5f83d37a9022283f53a8abba4328f643

Logs

from Sentry:

BackgroundServiceStartNotAllowedException: Not allowed to start service Intent { act=ACTION_INCOMING_CALL cmp=com.workiz/.RNTwilio.IncomingCallNotificationService (has extras) }: app is in background uid UidRecord{1554114 u0a353 RCVR bg:+5m35s924ms idle change:uncached procs:0 seq(0,0,0)}

Versions

All relevant version information for the issue.

Voice Android SDK

6.0.1

OS Version

Android 12 - so far, this only happened with Android 12

Device Model

Galaxy S20 (reproduced with other devices as well)

rakefetWorkiz commented 2 years ago

Hi again, Could someone please look into this?

Adding some more info here,

I tried to see if maybe there is something missing with my code, I set up the latest quick start code to match with my credentials, to see if this was going to work with this code.

Unfortunately - even though I was able to receive incoming calls with the getting started app while the app is in the foreground - having incoming call while the app in the background doesn't work at all.

So if I call myself while the app is in the background/killed, a notification will show - giving me the option to decline/answer the call, but no matter what I choose - the notification will go away, and nothing else will happen (which is about 2 steps behind what I have working with my app 😓 )

This is highest priority, as users cannot use a phone app - that is unable to receive calls. Please tell me there is something that can be done to handle it 🙏

@kbagchiGWC FYI

rakefetWorkiz commented 2 years ago

Hello,

After some more research, and trying different approaches, we were able to solve this issue by opening the app's activity when the "accept" action is pressed.

Maybe you should change the QuickStart app, to support this option - so the developers who are coming across this issue in the future, will have a solution ready 😉

Best

kbagchiGWC commented 2 years ago

@rakefetWorkiz Thanks for reporting the issue. We will fix this in QS ASAP.