Skip to content

Conversation

fabriziomoscon
Copy link
Collaborator

@fabriziomoscon fabriziomoscon commented Nov 13, 2020

Android receives a background call with broadcast receiver and pass it to RN headless JS

// Application index.js
AppRegistry.registerHeadlessTask('BackgroundCallTaskService', () => ({
    call_state,
    call_sid,
    call_from, // this is the phone number or contact string from twilio
    call_to,
}) => {
    console.log('####### CALL RECEIVED')
    if (callState === 'PENDING') {
        // this needs to call the Android Phone app, because it is not possible to start the RN activity
    }
    return Promise.resolve();
});

Application AndroidManifest.xml

<service android:name="com.hoxfon.react.RNTwilioVoice.BackgroundCallTaskService"/>

<receiver android:name="com.hoxfon.react.RNTwilioVoice.BackgroundCallReceiver" android:exported="true">
    <intent-filter>
        <action android:name="com.hoxfon.HoxFon.DEV.debug.BACKGROUND_CALL" />
    </intent-filter>
</receiver>

@jdegger
Copy link
Collaborator

jdegger commented Nov 13, 2020

@fabriziomoscon great work, let me know when you want me to test and review

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.

2 participants