diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/keepalive/KeepAliveManager.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/keepalive/KeepAliveManager.java
index f1c6eb013..fdc5350e8 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/keepalive/KeepAliveManager.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/keepalive/KeepAliveManager.java
@@ -187,12 +187,36 @@ public void processPacket(Packet packet)
private class KeepAliveSendTask
extends TimerTask
{
+ /**
+ * Minimal sleep interval between calls to this TimerTask.
+ */
+ private final long MIN_WAKE_UP_INTERVAL = 5000L; // 5 sec
+
+ /**
+ * Remembers when it was woken up for the last time.
+ */
+ private long lastWakeUp;
+
/**
* Sends a single KeepAliveEvent.
*/
@Override
public void run()
{
+ /**
+ * Timers on Android when CPU is sleeping can often sleep for too
+ * long and then they try to catch up doing rapid callbacks.
+ * The intention here is to filter out such calls.
+ */
+ long sleepDuration = (System.currentTimeMillis() - lastWakeUp);
+ lastWakeUp = System.currentTimeMillis();
+
+ if(sleepDuration < MIN_WAKE_UP_INTERVAL)
+ {
+ logger.error( this + " woken up too early !");
+ return;
+ }
+
// if we are not registered do nothing
if(!parentProvider.isRegistered())
{