Skip to content

Commit

Permalink
Make some use of the ping manager
Browse files Browse the repository at this point in the history
Signed-off-by: Daniele Ricci <[email protected]>
  • Loading branch information
daniele-athome committed Mar 4, 2015
1 parent 526db72 commit 94cc3ab
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
import org.jivesoftware.smackx.iqlast.packet.LastActivity;
import org.jivesoftware.smackx.iqversion.VersionManager;
import org.jivesoftware.smackx.ping.PingFailedListener;
import org.jivesoftware.smackx.ping.PingManager;
import org.jivesoftware.smackx.ping.android.ServerPingWithAlarmManager;
import org.jivesoftware.smackx.receipts.DeliveryReceipt;
import org.jivesoftware.smackx.receipts.DeliveryReceiptRequest;
Expand Down Expand Up @@ -980,6 +982,15 @@ public synchronized void created(XMPPConnection connection) {

// enable ping manager
ServerPingWithAlarmManager.getInstanceFor(connection).setEnabled(true);
PingManager.getInstanceFor(connection)
.registerPingFailedListener(new PingFailedListener() {
@Override
public void pingFailed() {
Log.v(TAG, "ping failed, restarting message center");
// restart message center
restart(getApplicationContext());
}
});

PacketFilter filter;

Expand Down

0 comments on commit 94cc3ab

Please sign in to comment.