Skip to content
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

feat: Android Twilio SDK 5.4.2 #164

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

fabriziomoscon
Copy link
Collaborator

@fabriziomoscon fabriziomoscon commented Nov 15, 2020

Ported Twilio quickstart changes up to this point twilio/voice-quickstart-android@e3db03f

  • notification for incoming call when the app is in the background

  • implement Android v5

  • test making a call

  • test incoming call, when app in foreground

  • test incoming call, when app in background

  • test incoming call, when app is closed

  • test after a call invite is cancelled, opening the JS app doesn't trigger the incoming call screen

  • cleanup XML resources

  • incoming notifications when the device is locked

  • correctly cleanup a CALL_INVITE after answering or missed, currently the second time the app is stuck with this log:

  • Error when receiving a call and the app is closed

2020-11-15 12:53:28.746 32167-32167/? W/GCM: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.hoxfon.HoxFon.DEV.debug (has extras) }

Known issues:

  • Call invite heads-up notification are not auto cancelled. This issue happens when a call is received and the screen is locked or the screen in unlocked, but the app is in the background. The heads-up notification service is started. If the user taps on the notification full screen content (not reject nor answer button), and then accepts the call from JS, at the end of the call the heads-up notification won't be removed, because there is no push notification for end call, just for call invite cancelled by the caller. I don't know how to solve this issue, because endForeground() can only be called by the service and all the user interactions from JS end are handled by the VoiceModule. At the same time full screen content is needed to show the JS incoming call screen when the phone is locked, therefore it can't be removed.

Reported bugs:

@fmonsalvo
Copy link
Contributor

@fabriziomoscon is there any reason why you are upgrading to 5.0.1 and not to 5.6.0? I'm asking since #39 depends on Android SDK being 5.3.0 or newer.

@fabriziomoscon fabriziomoscon force-pushed the feat/twilio-android-sdk-5 branch from 98c7b0f to d115aa4 Compare November 19, 2020 00:12
@fabriziomoscon
Copy link
Collaborator Author

@fmonsalvo I am going through all commits here: https://github.com/twilio/voice-quickstart-android/commits one by one and port them

@fmonsalvo
Copy link
Contributor

fmonsalvo commented Nov 20, 2020

Perfect, just wanted to know the rationale. I appreciate all your hard work!

@fabriziomoscon fabriziomoscon force-pushed the feat/twilio-android-sdk-5 branch from d115aa4 to 9544f0a Compare December 6, 2020 11:45
@fabriziomoscon fabriziomoscon force-pushed the feat/twilio-android-sdk-5 branch from 9544f0a to 4c6e57c Compare December 6, 2020 18:22
@fabriziomoscon fabriziomoscon changed the title feat: Android Twilio SDK 5.0.1 feat: Android Twilio SDK 5.0.2 Dec 12, 2020
@fabriziomoscon fabriziomoscon force-pushed the feat/twilio-android-sdk-5 branch 3 times, most recently from 909ae47 to 458b0d4 Compare December 12, 2020 19:23
@Samsritha1596
Copy link

@fabriziomoscon Hi. I have updated the Android Twilio SDK 5.0.2 code from this branch (458b0d4) and still facing same issue for incoming call.

@fabriziomoscon
Copy link
Collaborator Author

@Samsritha1596 please refer to the above checklist to see the completion stage of this PR. Currently test incoming call, when app is closed is unchecked. Note that this use case is one of the known issue with the current master branch, which PR aims to solve.

@fabriziomoscon
Copy link
Collaborator Author

@Samsritha1596 please try to use this commit: 88f4f73 and let me know if you can receive calls when the app is killed.

@Samsritha1596
Copy link

Samsritha1596 commented Dec 22, 2020

@fabriziomoscon Incoming call is not receiving when app is killed and also no events were triggered

Here is the version details:

"react-native": "0.61.5",
"react-native-twilio-programmable-voice": "^4.3.0",
"react-native-push-notification": "^6.1.3",

Please find the attached screenshot for app is killed

Screenshot 2020-12-22 at 12 36 55 PM

@Samsritha1596
Copy link

@fabriziomoscon Any update ?

@fabriziomoscon
Copy link
Collaborator Author

You are not using this PR branch

"react-native-twilio-programmable-voice": "^4.3.0"

Please use:

"react-native-twilio-programmable-voice": "https://github.com/hoxfon/react-native-twilio-programmable-voice#feat/twilio-android-sdk-5",

@fabriziomoscon fabriziomoscon force-pushed the feat/twilio-android-sdk-5 branch 5 times, most recently from 9ed4984 to fcbf160 Compare December 26, 2020 22:19
@Samsritha1596
Copy link

Samsritha1596 commented Dec 28, 2020

@fabriziomoscon Receives heads-up notification when app is killed and background without ringing and does not trigger any event

@fabriziomoscon
Copy link
Collaborator Author

@Samsritha1596

Receives heads-up notification when app is killed and background

This is the correct behaviour

without ringing

I don't know if the limitation for background services in Android 10 allow to ring, because they rely on the sound the user sets for notifications

does not trigger any event

This is right, because the JS app is not started, it can't deliver any event. Only tapping on ACCEPT will start the app and deliver the event to JS

@Samsritha1596
Copy link

@fabriziomoscon Behaves the same way after adding USE_FULL_SCREEN_INTENT

@fabriziomoscon fabriziomoscon force-pushed the feat/twilio-android-sdk-5 branch from 4538880 to b1ba68f Compare December 29, 2020 20:08
@fabriziomoscon
Copy link
Collaborator Author

@Samsritha1596
Please retry now, note that I pushed forced new commits.

@Samsritha1596
Copy link

@fabriziomoscon Screen does not invoke automatically when device is locked

@fabriziomoscon fabriziomoscon force-pushed the feat/twilio-android-sdk-5 branch from b50f2be to 9a8f98f Compare January 2, 2021 20:00
@ro-mgh
Copy link

ro-mgh commented Apr 22, 2021

Hi @fabriziomoscon! I've prepared updates to this branch incl. unregistartion for Android/IOS, and I also solved an issue with "Call invite heads-up notification are not auto cancelled". Can we contact somehow to include those changes to #164 PR?

@fabriziomoscon fabriziomoscon force-pushed the feat/twilio-android-sdk-5 branch from 8281e62 to 4c17157 Compare June 13, 2021 12:49
It is needed for com.twilio.audioswitch dependency
@fabriziomoscon fabriziomoscon changed the title feat: Android Twilio SDK 5.0.2 feat: Android Twilio SDK 5.4.2 Jul 12, 2021
@fabriziomoscon fabriziomoscon force-pushed the feat/twilio-android-sdk-5 branch from 396e369 to 544b1a7 Compare August 2, 2021 19:59
@adyra
Copy link

adyra commented Aug 27, 2021

Hello, thanks for make this library update. I've found some issues on getAudioDevices and getSelectedAudioDevice, it returning undefined, apparently the result is not returned on method in index.js, so i make changes like this:

async getAudioDevices() {
    if (Platform.OS === IOS) {
        return
    }
    return await TwilioVoice.getAudioDevices()
},
    
async getSelectedAudioDevice() {
    if (Platform.OS === IOS) {
        return
    }
    return await TwilioVoice.getSelectedAudioDevice()
},

I also make change on method selectAudioDevice in TwilioVoiceModule.java, so when user send null param, audioSwitch will select a device automatically based on the following priority: BluetoothHeadset -> WiredHeadset -> Earpiece -> Speakerphone

@ReactMethod
public void selectAudioDevice(String name) {
    if (name != null) {
        AudioDevice selected = availableAudioDevices.get(name);
        if (selected == null) {
            return;
        }
        audioSwitch.selectDevice(selected);
    } else {
        audioSwitch.selectDevice(null);
    }
}

Also please consider to bring back method setSpeakerPhone on android, with audioSwitch we can make something like this:

@ReactMethod
public void setSpeakerPhone(Boolean value) {
  if (value) {
    AudioDevice speakerphoneDevice = availableAudioDevices.get("Speakerphone");
      if (speakerphoneDevice != null) {
          audioSwitch.selectDevice(speakerphoneDevice);
      }
  } else {
      audioSwitch.selectDevice(null);
  }
}

@jdegger jdegger removed their request for review June 13, 2022 06:19
@julien9999
Copy link

julien9999 commented Jun 24, 2022

Android 12 support + setSpeaker functionality: #211 (comment)

@fabriziomoscon fabriziomoscon force-pushed the feat/twilio-android-sdk-5 branch from d489656 to 47a926a Compare August 14, 2023 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants