Using Twilio Android SDK from an Android Service
See original GitHub issueWe’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:
- Created 7 years ago
- Comments:18 (10 by maintainers)
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
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