question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using Twilio Android SDK from an Android Service

See original GitHub issue

We’re experiencing some troubles with the Twilio Video-SDK when using it based on a Service. The use-case is as follows:

The user gets authenticated with Twilio (JWT token is provided by our authentication server - links to it’s source code at the end of this post), joins his own room (each user has one room based on his username and some other identifiers) then moves the App into the background. A service listens for room related events and notifies the user when someone joins his room (i.e. tries to call him by picking him from a list of people that are registered). Then the callee clicks on the notification and the call dialog opens. Note, that the callee was already in his own room before opening the call dialog, since he was notified of the call attempt, when someone else joined his room.

At this point the following issues come up (more or less randomly):

In onConnected when iterating over the participants it happens, that the same participants exists twice in the list and the other participant does not exist at all when calling room.getParticipants().entrySet (where aRoom = an instance of com.twilio.video.Room)

The first call between two devices is usually successful, subsequent calls may exhibit above behavior in about 30%-50% of the cases. This was found out by simply printing each participant returned by room.getParticipants().entrySet. Another issue was that in the android video quickstart only the first participant in the list found in onConnected(Room room)is passed on to the private void addParticipant(Participant participant) method. However it also seems the first participant is not always the caller, but can be the callee as well, in which case the callee would call private void addParticipant(Participant participant) passing itself.

We have opensourced our mobile client using the twilio SDK as well as our authentication server, which is based on the original twilio-provided Apache Spark authentication server sample (for Java). You can find bot of them here:

Twilio Android Project Spark based authentication server

Please let us know if we can provide any further details.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
aaalanizcommented, Apr 28, 2017

Hey @FranziscaZarrai

Can you try updating to our 1.0.0 release? Please let us know if you are still experiencing crashes in the latest release and we will diagnose.

Thanks

1reaction
dreamernscommented, Mar 31, 2017

That is also possible scenario. If one of participant looses connection, it would remain in room as “ghost” for next 2 minutes. Unfortunately, we don’t have good solution right now for this problem, but our backend team is working on it and hopefully there will be a fix soon. As workaround you could put some additional timeout on client side that would cut down time. Something like a client ping.

Thanks, Nikola

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started with the Voice Android SDK - Twilio
Learn how to add voice communications to your mobile applications with Twilio's Programmable Voice API in this Twilio Voice Quickstart for Android.
Read more >
Voice Android SDK | Twilio
Twilio Programmable Voice SDK for Android allows you to add voice-over-IP (VoIP) calling into your native Android applications. For step-by-step instructions to ...
Read more >
Integrating Twilio Verification SDK for Android using the ...
Learn how to integrate the Twilio Verification SDK for Android using a sample backend in this guide.
Read more >
Getting Started: Twilio Programmable Video with Android
Learn how to build a video application with Twilio's Programmable Video API and the Twilio Android SDK in this Programmable Video Quickstart.
Read more >
Twilio Verification SDK for Android - Integration guide
Learn how to integrate the Twilio Verification SDK into an application running on Android in this guide.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found