react-native-callkeep icon indicating copy to clipboard operation
react-native-callkeep copied to clipboard

[ANDROID] didActivateAudioSession is not triggered in Android

Open devartwa opened this issue 2 years ago • 0 comments

Bug report

  • [X] I've checked the example to reproduce the issue.

  • Reproduced on:

  • [X] Android

  • [ ] iOS

Description

In iOS works fine, but when I'm calling another number, the ringtone inside the listener (described in docs) is not working. The listener is triggered only in iOS. Is there any solution?

My code:

RNCallKeep.addEventListener('didActivateAudioSession', () => {
  endpoint.activateAudioSession();

  if (outgoingCall) {
    setTimeout(() => {
      ringtone = new Sound('tone.mp3', Sound.MAIN_BUNDLE, error => {
        if (error) {
          console.log('failed to load the sound', error);
          return;
        }

        ringtone?.setVolume(1);
        ringtone?.setNumberOfLoops(-1);
        ringtone?.play((success: any) => {
          if (success) {
            console.log('successfully finished playing');
          } else {
            console.log('playback failed due to audio decoding errors');
          }
        });
      });
    }, 500);
  }
});

Steps to Reproduce

Versions

- Callkeep: 4.3.3
- React Native: 0.66.3
- iOS: -
- Android: 12
- Phone model: Pixel 4

Logs

devartwa avatar Jun 02 '22 21:06 devartwa