Closed jackywxd closed 2 years ago
@jackywxd this is not enough. When the app is killed, the variable RNTwilioPhone.callKeepOptions
is cleared, so when RNTwilioPhone.handleBackgroundState
is invoked after the app is killed RNTwilioPhone.callKeepOptions
is undefined.
The solutions is for RNTwilioPhone.handleBackgroundState
to accept callKeepOptions
itself, like this:
static handleBackgroundState(callKeepOptions: IOptions) {
...
RNCallKeep.registerPhoneAccount(RNTwilioPhone.callKeepOptions || callKeepOptions);
...
}
Thanks @jackywxd for creating this PR and thanks @armouti for your feedback. I have included these changes in a more global update of this module:
https://github.com/MrHertal/react-native-twilio-phone/releases/tag/v1.9.0
It should work properly now. I will close that PR.
RNCallKeep.registerPhoneAccount() is called without passing the required callKeepOptions. This will prevent the CallKeep from handling incoming calls in background, and will get error:
[TypeError: Cannot read properties of undefined (reading 'android')]
Because callKeepOptions was missing (undefined).
Fix for issue #75