Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twilio IP Messaging: Channel join in Android not working properly

Tags:

android

twilio

I'm using Twilio library 0.9.1

I've created a channel and joined it. The unique name of channel is stored in a SQLite database. If I open app later some time, got the channel name from db and using getChannelByUniqueName method to get channel object. Before using this channel object for sending and receiving messages, I have to connect.

  1. For that connection which method should i use?

  2. Now i'm using join method for connecting and call back for join isn't able to get some times?

Using below snippet to join channel:

channel.join(new com.twilio.ipmessaging.Constants.StatusListener() {
@Override
public void onSuccess() {
    Utilities.writeToLogFile(Constants.LOG_ERROR_LEVEL, "Joined with channel: " + channel.getUniqueName());
}

@Override
public void onError(ErrorInfo errorInfo) {
    Utilities.writeToLogFile(Constants.LOG_ERROR_LEVEL, "Error joining channel: " + errorInfo.getErrorText());
}
});

The channel object I got from using getChannelsByUniqueName method of Channels class. I didn't get callback for join StatusListener sometimes. Neither receiver onSuccess nor onError callbacks.

Logs from library:

11-01 11:37:05.006 15337-17811/com.myorg.myapp E/com.myorg.myapp.util.Utilities: IP Messaging Received completely initialized IPMessagingClient

11-01 11:37:41.866 15337-17929/com.myorg.myapp W/art: Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[71,tid=17929,Native,Thread*=0xb8256a28,peer=0x239810a0,"om.myorg.myapp- 17929"]

11-01 11:37:41.866 15337-17932/com.myorg.myapp W/art: Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[72,tid=17932,Native,Thread*=0xb80d9980,peer=0x239ad1c0,"ne.rolo - 17929 - 17932"]

11-01 11:37:41.876 15337-17931/com.myorg.myapp E/com.myorg.myapp.util.Utilities: ************** MSG SENDING:Yummy

11-01 11:37:41.886 15337-17931/com.myorg.myapp W/art: Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[71,tid=17931,Native,Thread*=0xb831af58,peer=0x23981100,"ne.rolo - 17929 - 17931"]

like image 705
dev1993 Avatar asked Dec 21 '25 17:12

dev1993


1 Answers

Please check that you have synched your channels before getting the channel.

Something like client.getChannels().getChannel() might not work in the 0.9.1 release.

Here are the examples of retrieving channel object: one and two

I'm fixing this and many other listener problems for 0.10.0 release which is coming out real soon.

like image 174
Berkus Avatar answered Dec 23 '25 08:12

Berkus