I've got a Andriod Studio project and I'm trying to use the SocketIOClient from the AndroidAsync library. I'm building the library with the command:
dependencies {
compile 'com.koushikdutta.androidasync:AndroidAsync:1.0.0'
}
I was able to get the websocket example to work, but there's seems to be a version issue with the 1.0 and the SocketIOClient example. I've also tried using the 2.0 jar file, but SocketIOClient doesn't appear to be defined there at all(this is one of my first andriod applications, so maybe I'm just doing something wrong). Does anyone know what needs to be done to get the following code to compile:
SocketIOClient.connect(AsyncHttpClient.getDefaultInstance(), "http://192.168.1.2:3000", new ConnectCallback() {
@Override
public void onConnectCompleted(Exception ex, SocketIOClient client) {
if (ex != null) {
ex.printStackTrace();
return;
}
client.setStringCallback(new StringCallback() {
@Override
public void onString(String string) {
System.out.println(string);
}
});
client.on("someEvent", new EventCallback() {
@Override
public void onEvent(JSONArray argument, Acknowledge acknowledge) {
System.out.println("args: " + arguments.toString());
}
});
client.setJSONCallback(new JSONCallback() {
@Override
public void onJSON(JSONObject json) {
System.out.println("json: " + json.toString());
}
});
}
});
Thanks, Scott