src/main/java/org/jivesoftware/smack/keepalive/KeepAliveManager.java
private void handleConnect() {
        Connection connection = weakRefConnection.get();
        // Listen for all incoming packets and reset the scheduled ping whenever
        // one arrives.
        connection.addPacketListener(new PacketListener() {

            @Override
            public void processPacket(Packet packet) {
                // reschedule the ping based on this last server contact
                lastSuccessfulContact = System.currentTimeMillis();
                schedulePingServerTask();
            }
        }, null);
    }
private void handleConnect() {
        Connection connection = weakRefConnection.get();
        // Listen for all incoming packets and reset the scheduled ping whenever
        // one arrives.
        connection.addPacketListener(new PacketListener() {

            @Override
            public void processPacket(Packet packet) {
                // reschedule the ping based on this last server contact
                lastSuccessfulContact = System.currentTimeMillis();
                schedulePingServerTask();
            }
        }, null);
    }
private void handleConnect ( ) { Connection connection = weakRefConnection . get ( ) ; // Listen for all incoming packets and reset the scheduled ping whenever // one arrives. connection . addPacketListener ( new PacketListener ( ) { @ Override public void processPacket ( Packet packet ) { // reschedule the ping based on this last server contact lastSuccessfulContact = System . currentTimeMillis ( ) ; schedulePingServerTask ( ) ; } } , null ) ; }
/*
Call after every connection to add the packet listener.
/ * Call after every connection to add the packet listener .