cybex-dev / twilio_voice

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

Call voice is not working when android is locked #126

Closed kashiftariq1997 closed 1 year ago

kashiftariq1997 commented 1 year ago

Call voice is not working when Android is locked. when my phone is locked and a voice from the phone which it calls is coming. but the voice from the app is not going to the other phone.

kashiftariq1997 commented 1 year ago

@diegogarciar It works with Android 10 but not working with above versions

cybex-dev commented 1 year ago

@kashiftariq1997 thanks for the report. I'll check calls between Android 8-11.

This are a few pending PRs & fixes - might ask you to confirm resolved after I update repo.

kashiftariq1997 commented 1 year ago

@cybex-dev Can you please review this on priority if you want to connect with me I can schedule a call this is my email workkashif574@gmail.com I can explain the whole scenario

cybex-dev commented 1 year ago

@kashiftariq1997 I'll be reviewing this weekend.

kashiftariq1997 commented 1 year ago

@cybex-dev let me know when you update to fix this issue It's urgent for me.

kashiftariq1997 commented 1 year ago

Hi, @cybex-dev - That would be great if you can check this on priority. it is something that is super urgent for me and I'm not able to find any solution yet. The scenario is already explained to you. Looking forward to hear from you. Thanks.

cybex-dev commented 1 year ago

Hi, @cybex-dev - That would be great if you can check this on priority. it is something that is super urgent for me and I'm not able to find any solution yet. The scenario is already explained to you. Looking forward to hear from you. Thanks.

Hi @kashiftariq1997, I'll be investigating this afternoon.

To confirm, the scenario:

kashiftariq1997 commented 1 year ago

Hi, @cybex-dev - That would be great if you can check this on priority. it is something that is super urgent for me and I'm not able to find any solution yet. The scenario is already explained to you. Looking forward to hear from you. Thanks.

Hi @kashiftariq1997, I'll be investigating this afternoon.

To confirm, the scenario:

  • you (Android, which version?) are placing a call to another device (Android, which version?) .
  • Do you do you have mic and/or background permissions set on the device calling AND on the device receiving?
  • What are the states of each of the devices (locked? screen on?) when this 'issue' occurs?

Thanks for replying to me.

  1. The Android version is greater than 10 which is causing issues. I tested on Android 11, 12, 13. All are having the same issue. Actually, calling another device (version) doesn't matter as we're calling on the Phone number, not on the application.
  2. Yes, all permissions are present. There is no issue with that.
  3. Device is locked. I mean the screen is off.

Let me explain the whole scenario one more time, I've installed the application on my Phone. The Application is in the foreground state. The Phone screen is locked. There is a separate hardware device that sends a trigger via Bluetooth. That device is connected to the App via Bluetooth. when the app received the trigger (the app is in the foreground and the phone is locked as well), the call automatically goes to the Phone number which needs to be dialed on that trigger. When the other person receives the call on the phone, then there is smooth communication between both of them. The other person from where the call triggered is having default speaker on as per implementation because his phone is in a locked state. Everything is working fine as I mentioned/explained but till Android 10. On higher android versions greater than 10, there is an issue with Mic access where the app is installed (from where the trigger occurred). I hope you got my point. Do let me know, if you want something further from me. Thanks.

cybex-dev commented 1 year ago

Hi, @cybex-dev - That would be great if you can check this on priority. it is something that is super urgent for me and I'm not able to find any solution yet. The scenario is already explained to you. Looking forward to hear from you. Thanks.

Hi @kashiftariq1997, I'll be investigating this afternoon. To confirm, the scenario:

  • you (Android, which version?) are placing a call to another device (Android, which version?) .
  • Do you do you have mic and/or background permissions set on the device calling AND on the device receiving?
  • What are the states of each of the devices (locked? screen on?) when this 'issue' occurs?

Thanks for replying to me.

  1. The Android version is greater than 10 which is causing issues. I tested on Android 11, 12, 13. All are having the same issue. Actually, calling another device (version) doesn't matter as we're calling on the Phone number, not on the application.
  2. Yes, all permissions are present. There is no issue with that.
  3. Device is locked. I mean the screen is off.

Let me explain the whole scenario one more time, I've installed the application on my Phone. The Application is in the foreground state. The Phone screen is locked. There is a separate hardware device that sends a trigger via Bluetooth. That device is connected to the App via Bluetooth. when the app received the trigger (the app is in the foreground and the phone is locked as well), the call automatically goes to the Phone number which needs to be dialed on that trigger. When the other person receives the call on the phone, then there is smooth communication between both of them. The other person from where the call triggered is having default speaker on as per implementation because his phone is in a locked state. Everything is working fine as I mentioned/explained but till Android 10. On higher android versions greater than 10, there is an issue with Mic access where the app is installed (from where the trigger occurred). I hope you got my point. Do let me know, if you want something further from me. Thanks.

Right, I think I've got an (rough) understanding of your scenario.

I've got some Android devices >=11 which I'll attempt to replicate the problem. I'll be testing calls from a >=11 Android device to another (Android/iOS) device in a phone locked, screen off and in foreground app state.


If I understand you scenario correctly, in this particular case I should not hear anything on the "other" device receiving the call but I should hear something in the device placing the call.

kashiftariq1997 commented 1 year ago

Hi, @cybex-dev - That would be great if you can check this on priority. it is something that is super urgent for me and I'm not able to find any solution yet. The scenario is already explained to you. Looking forward to hear from you. Thanks.

Hi @kashiftariq1997, I'll be investigating this afternoon. To confirm, the scenario:

  • you (Android, which version?) are placing a call to another device (Android, which version?) .
  • Do you do you have mic and/or background permissions set on the device calling AND on the device receiving?
  • What are the states of each of the devices (locked? screen on?) when this 'issue' occurs?

Thanks for replying to me.

  1. The Android version is greater than 10 which is causing issues. I tested on Android 11, 12, 13. All are having the same issue. Actually, calling another device (version) doesn't matter as we're calling on the Phone number, not on the application.
  2. Yes, all permissions are present. There is no issue with that.
  3. Device is locked. I mean the screen is off.

Let me explain the whole scenario one more time, I've installed the application on my Phone. The Application is in the foreground state. The Phone screen is locked. There is a separate hardware device that sends a trigger via Bluetooth. That device is connected to the App via Bluetooth. when the app received the trigger (the app is in the foreground and the phone is locked as well), the call automatically goes to the Phone number which needs to be dialed on that trigger. When the other person receives the call on the phone, then there is smooth communication between both of them. The other person from where the call triggered is having default speaker on as per implementation because his phone is in a locked state. Everything is working fine as I mentioned/explained but till Android 10. On higher android versions greater than 10, there is an issue with Mic access where the app is installed (from where the trigger occurred). I hope you got my point. Do let me know, if you want something further from me. Thanks.

Right, I think I've got an (rough) understanding of your scenario.

I've got some Android devices >=11 which I'll attempt to replicate the problem. I'll be testing calls from a >=11 Android device to another (Android/iOS) device in a phone locked, screen off and in foreground app state.

If I understand you scenario correctly, in this particular case I should not hear anything on the "other" device receiving the call but I should hear something in the device placing the call.

Yes, exactly. But one thing here needs attention, call is being placed with trigger from hardware device as I mentioned. There is no activity open I mean.

cybex-dev commented 1 year ago

Hi, @cybex-dev - That would be great if you can check this on priority. it is something that is super urgent for me and I'm not able to find any solution yet. The scenario is already explained to you. Looking forward to hear from you. Thanks.

Hi @kashiftariq1997, I'll be investigating this afternoon. To confirm, the scenario:

  • you (Android, which version?) are placing a call to another device (Android, which version?) .
  • Do you do you have mic and/or background permissions set on the device calling AND on the device receiving?
  • What are the states of each of the devices (locked? screen on?) when this 'issue' occurs?

Thanks for replying to me.

  1. The Android version is greater than 10 which is causing issues. I tested on Android 11, 12, 13. All are having the same issue. Actually, calling another device (version) doesn't matter as we're calling on the Phone number, not on the application.
  2. Yes, all permissions are present. There is no issue with that.
  3. Device is locked. I mean the screen is off.

Let me explain the whole scenario one more time, I've installed the application on my Phone. The Application is in the foreground state. The Phone screen is locked. There is a separate hardware device that sends a trigger via Bluetooth. That device is connected to the App via Bluetooth. when the app received the trigger (the app is in the foreground and the phone is locked as well), the call automatically goes to the Phone number which needs to be dialed on that trigger. When the other person receives the call on the phone, then there is smooth communication between both of them. The other person from where the call triggered is having default speaker on as per implementation because his phone is in a locked state. Everything is working fine as I mentioned/explained but till Android 10. On higher android versions greater than 10, there is an issue with Mic access where the app is installed (from where the trigger occurred). I hope you got my point. Do let me know, if you want something further from me. Thanks.

Right, I think I've got an (rough) understanding of your scenario. I've got some Android devices >=11 which I'll attempt to replicate the problem. I'll be testing calls from a >=11 Android device to another (Android/iOS) device in a phone locked, screen off and in foreground app state. If I understand you scenario correctly, in this particular case I should not hear anything on the "other" device receiving the call but I should hear something in the device placing the call.

Yes, exactly. But one thing here needs attention, call is being placed with trigger from hardware device as I mentioned. There is no activity open I mean.

Hmm - is it possible you can share the Intent/Service/Triggering/Method code opening the app to place a call?

kashiftariq1997 commented 1 year ago

Hi, @cybex-dev - That would be great if you can check this on priority. it is something that is super urgent for me and I'm not able to find any solution yet. The scenario is already explained to you. Looking forward to hear from you. Thanks.

Hi @kashiftariq1997, I'll be investigating this afternoon. To confirm, the scenario:

  • you (Android, which version?) are placing a call to another device (Android, which version?) .
  • Do you do you have mic and/or background permissions set on the device calling AND on the device receiving?
  • What are the states of each of the devices (locked? screen on?) when this 'issue' occurs?

Thanks for replying to me.

  1. The Android version is greater than 10 which is causing issues. I tested on Android 11, 12, 13. All are having the same issue. Actually, calling another device (version) doesn't matter as we're calling on the Phone number, not on the application.
  2. Yes, all permissions are present. There is no issue with that.
  3. Device is locked. I mean the screen is off.

Let me explain the whole scenario one more time, I've installed the application on my Phone. The Application is in the foreground state. The Phone screen is locked. There is a separate hardware device that sends a trigger via Bluetooth. That device is connected to the App via Bluetooth. when the app received the trigger (the app is in the foreground and the phone is locked as well), the call automatically goes to the Phone number which needs to be dialed on that trigger. When the other person receives the call on the phone, then there is smooth communication between both of them. The other person from where the call triggered is having default speaker on as per implementation because his phone is in a locked state. Everything is working fine as I mentioned/explained but till Android 10. On higher android versions greater than 10, there is an issue with Mic access where the app is installed (from where the trigger occurred). I hope you got my point. Do let me know, if you want something further from me. Thanks.

Right, I think I've got an (rough) understanding of your scenario. I've got some Android devices >=11 which I'll attempt to replicate the problem. I'll be testing calls from a >=11 Android device to another (Android/iOS) device in a phone locked, screen off and in foreground app state. If I understand you scenario correctly, in this particular case I should not hear anything on the "other" device receiving the call but I should hear something in the device placing the call.

Yes, exactly. But one thing here needs attention, call is being placed with trigger from hardware device as I mentioned. There is no activity open I mean.

Hmm - is it possible you can share the Intent/Service/Triggering/Method code opening the app to place a call?

Are you asking to share APK with you so can download and test the scenerio which I am stating? If yes, then I can share. But obviously I cannot share the hardware device that sends trigger to initiate the call. But I can guide you how to reproduce the same scenerio while using the App only. Also, if you got the clarity then you can also check on your side in the package. It is completely working fine but till Android 10.

cybex-dev commented 1 year ago

Hi, @cybex-dev - That would be great if you can check this on priority. it is something that is super urgent for me and I'm not able to find any solution yet. The scenario is already explained to you. Looking forward to hear from you. Thanks.

Hi @kashiftariq1997, I'll be investigating this afternoon. To confirm, the scenario:

  • you (Android, which version?) are placing a call to another device (Android, which version?) .
  • Do you do you have mic and/or background permissions set on the device calling AND on the device receiving?
  • What are the states of each of the devices (locked? screen on?) when this 'issue' occurs?

Thanks for replying to me.

  1. The Android version is greater than 10 which is causing issues. I tested on Android 11, 12, 13. All are having the same issue. Actually, calling another device (version) doesn't matter as we're calling on the Phone number, not on the application.
  2. Yes, all permissions are present. There is no issue with that.
  3. Device is locked. I mean the screen is off.

Let me explain the whole scenario one more time, I've installed the application on my Phone. The Application is in the foreground state. The Phone screen is locked. There is a separate hardware device that sends a trigger via Bluetooth. That device is connected to the App via Bluetooth. when the app received the trigger (the app is in the foreground and the phone is locked as well), the call automatically goes to the Phone number which needs to be dialed on that trigger. When the other person receives the call on the phone, then there is smooth communication between both of them. The other person from where the call triggered is having default speaker on as per implementation because his phone is in a locked state. Everything is working fine as I mentioned/explained but till Android 10. On higher android versions greater than 10, there is an issue with Mic access where the app is installed (from where the trigger occurred). I hope you got my point. Do let me know, if you want something further from me. Thanks.

Right, I think I've got an (rough) understanding of your scenario. I've got some Android devices >=11 which I'll attempt to replicate the problem. I'll be testing calls from a >=11 Android device to another (Android/iOS) device in a phone locked, screen off and in foreground app state. If I understand you scenario correctly, in this particular case I should not hear anything on the "other" device receiving the call but I should hear something in the device placing the call.

Yes, exactly. But one thing here needs attention, call is being placed with trigger from hardware device as I mentioned. There is no activity open I mean.

Hmm - is it possible you can share the Intent/Service/Triggering/Method code opening the app to place a call?

Are you asking to share APK with you so can download and test the scenerio which I am stating? If yes, then I can share. But obviously I cannot share the hardware device that sends trigger to initiate the call. But I can guide you how to reproduce the same scenerio while using the App only. Also, if you got the clarity then you can also check on your side in the package. It is completely working fine but till Android 10.

What I meant was the code that launches/places a call and opens up the app containing the twilio_voice package. i.e. is it another package that sends an e.g. Broadcast request?

cybex-dev commented 1 year ago

e.g. Hardware app (trigger call), sends Broadcast to start app. Flutter (with Twilio) app listens and responds to with e.g. BroadcastReceiver and requests Flutter to place call.

What is this calling code?

kashiftariq1997 commented 1 year ago

@cybex-dev - Actually, I didn't understand your question properly. But I would like to share my findings on the package with you as per my research.

I've checked the package. it is only handling the incoming call notification service. But we don't have an Outgoingnotificationservice in the package. So In my case when the phone is locked and the app is in the foreground then on Calling TwilioVoice.call.place(); should run an Outgoingnotificationservice. This service will actually be triggering the notification/Dialer etc on the phone from where the call is going and on the basis of that the Mic will start working as well because the phone state will be changed.

kashiftariq1997 commented 1 year ago

@cybex-dev https://drive.google.com/file/d/1xJQQiMvBfxcM52FQCgU5F3pVM1Q5FfPm/view?usp=sharing

logs are in this video link

cybex-dev commented 1 year ago

@kashiftariq1997 please post the logs here instead, would be appreciated.

cybex-dev commented 1 year ago

@kashiftariq1997 I've tested on Android devices >=11 in foreground, background w/ screen on & off. I have not been able to replicate this problem.

Please provide some MCVE for me to review since I am unable to gather a reproducible example from your description.

kashiftariq1997 commented 1 year ago

@cybex-dev can you add a background service that runs on CallDirection.outgoing like incoming

cybex-dev commented 1 year ago

@kashiftariq1997 hmm, not sure I follow. Do you have an example of what you have in mind?

I'm currently implementing native call handling into the Android impl, so any incoming/outgoing calls should be handled by the default Android's 'callkit' (via ConnectionService)

kashiftariq1997 commented 1 year ago

@cybex-dev Example Is this Normally what happens if you want to make a call you open the app. And enter the phone number or client Id and tap the make call button and it pushed to the call screen.

But in our case, we have a Bluetooth device that sends a boolean value to the app when it's on. And when the app receives that boolean ( eg: 1 ) It makes a call. So the app is not open it's running background and the phone is locked when all this happens.

kashiftariq1997 commented 1 year ago

@cybex-dev - Hi, any update on above?

kashiftariq1997 commented 1 year ago

@cybex-dev - Hi, any update on default Android's 'callkit' (via ConnectionService)

cybex-dev commented 1 year ago

@cybex-dev - Hi, any update on default Android's 'callkit' (via ConnectionService)

Hi @kashiftariq1997, this is still in-development. I'll try to finish this weekend and have it made available early next week.

cybex-dev commented 1 year ago

@cybex-dev - Hi, any update on above?

Re: your issue, I was unable to replicate it - not sure if you'd want to wait for the Android update or you'd like to submit a (temporary) PR to address your problem.

cybex-dev commented 1 year ago

Took a bit of time - check it out #151

cybex-dev commented 1 year ago

See release 0.1.0