Skip to content

Conversation

goncalocostamendes
Copy link
Contributor

Providing sample integrating a connection service with the vonage webrtc functionalities

@goncalocostamendes goncalocostamendes changed the title VIDCS-3685: Connection Service VIDCS-3685: Connection Service integration with FCM for notifications push May 9, 2025
Comment on lines 3 to 8
This application provides a completed version of the OpenTok [Basic Video Chat tutorial](https://tokbox.com/developer/tutorials/android/) for Android (differing only in some additional validation checks). Upon deploying this sample application, you should be able to have two-way audio and video communication using OpenTok.

Main features:
* Connect to an OpenTok session
* Publish an audio-video stream to the session
* Subscribe to another client's audio-video stream
Copy link

@juliobecerragomez juliobecerragomez May 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we improve this README? I was expecting to find an introduction about the connection services and FCM (and how the app supports it).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I am working on it still. Should be pushed still today


private FcmEventSender() {}

// IMPORTANT: This network operation should NOT run on the main thread!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume there is one or several blocking calls, that's why you create a new thread. That said, isn't there any really asynchronous alternative?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are now using ExecutorService for async calls

@VZaphod
Copy link

VZaphod commented May 14, 2025

Does the microphone and camera capture work in background with the latest android SDKs?
Once the Connection Service launches the connection and the notification should launch another service with the Camera and Mic permissions.

@VZaphod
Copy link

VZaphod commented Jun 13, 2025

Updated sample with two buttons, outgoing call and incoming call. When tapping one of them will notify an incoming or outgoing call to the Android Telecom framework. A ConnectionService will start and configure the IncomingCallConnection or OutgoingCallConnection. Both are going to be instances of the VonnageConnectionClass. The ConnectionService will start and stop a foreground service that will let recording audio and video in the background.

Incoming calls will show a notification with accept and reject buttons, that will accept or reject the call. Once the call has been accepted the OpenTok session will start. When the user ends the call the Connection is destroyed, the foreground service stopped and the session cleared.

It's possible to notify an incoming call with the simulate_incoming_call.sh script provided in the sample.

When an incoming call arrives and the user presses the volume down button the ring will be muted.

When another call (like a PSTN) interrupts the video call the publisher should stop publishing.

For outgoing calls the flow is simpler, tap on the outgoing call button and the ConnectionService and Connection will be created and the UI updated accordingly.

VZaphod added 4 commits June 16, 2025 13:29
Translated literals to english
Using getSimpleName for TAGs
Added `ACTION_NOTIFY_INCOMING_CALL` for launching incoming calls from the push notification and MainActivity
Removed static usages from PhoneAccountManager
Removed `setCurrentConnection` from VonageManager
@VZaphod
Copy link

VZaphod commented Jun 20, 2025

Updated the sample with an Unhold button. When there is an ongoing session running and the user receives an external call ConnectionService will put the session on hold. When the external call ends the user has to click on Unhold to reactivate the ConnectionService state and the audio will restart.

Copy link

@VZaphod VZaphod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@joliveraortega
Copy link
Contributor

@goncalocostamendes We can go ahead and finish with this. 2.31.0 is out.

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.

5 participants