How to close reconnect SocketIOClient on android?
- by erginduran
My problem is reconnect.I connect SocketIOClient.connect(..) in background service.I close service when internet connection is off.and I re-start service again connection on.
How to close this reconnection?I don't want to reconnect SocketIOClient.
Its my code:
ConnectCallback mConnectCallback = new ConnectCallback() {
@Override
public void onConnectCompleted(Exception ex, SocketIOClient client) {
if (ex != null) {
ex.printStackTrace();
return;
}
client.setReconnectCallback(new ReconnectCallback() {
@Override
public void onReconnect() {
// TODO Auto-generated method stub
}
});
client.setDisconnectCallback(new DisconnectCallback() {
@Override
public void onDisconnect(Exception arg0) {
// TODO Auto-generated method stub
}
});
client.setErrorCallback(new ErrorCallback() {
@Override
public void onError(String arg0) {
// TODO Auto-generated method stub
}
});
client.on("event", new EventCallback() {
@Override
public void onEvent(JSONArray jsonArray, Acknowledge acknowledge) {
///bla bla
}
});
ScreenChat.mClient = client;
}
};