Quantcast
Channel: Ignite Realtime : Unanswered Discussions - Support
Viewing all articles
Browse latest Browse all 4979

How to handle connection lost on Android (Smack 4.1.1 - Openfire)

$
0
0

What is the best approach to set openfire for disconnecting idle users and in android clients to restart connection and authentification because

ConnectionListener, PingFailedListener don't do to job. My last thought were to catch android intent for network changes but there must be an xmpp solution I guess?

 

public void connect() throws IOException, XMPPException, SmackException {  xmpptcpConnection = new XMPPTCPConnection(XMPPTCPConnectionConfiguration.builder()   .setSecurityMode(disabled)   .setResource(resource)   .setHost(localhost)   .setServiceName(serviceName)   .setPort(port)   .setSendPresence(true)   .setDebuggerEnabled(true)   .build()  );  xmpptcpConnection.setPacketReplyTimeout(10000);  // Prepare listeners before inital connecting.  xmpptcpConnection.addConnectionListener(this);  xmpptcpConnection.connect();   // Every 10*60s = 10min.   PingManager.setDefaultPingInterval(600);   PingManager.getInstanceFor(xmpptcpConnection).registerPingFailedListener(this);
}

Viewing all articles
Browse latest Browse all 4979

Trending Articles