don't do idle ping if close_tcp option is set

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 6 
1 file changed, 4 insertions(+), 2 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/services/XmppConnectionService.java 🔗

@@ -581,7 +581,8 @@ public class XmppConnectionService extends Service {
 					refreshAllGcmTokens();
 					break;
 				case ACTION_IDLE_PING:
-					if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+					if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
+							&& !Config.CLOSE_TCP_WHEN_SWITCHING_TO_BACKGROUND) {
 						scheduleNextIdlePing();
 					}
 					break;
@@ -799,7 +800,8 @@ public class XmppConnectionService extends Service {
 		toggleForegroundService();
 		updateUnreadCountBadge();
 		toggleScreenEventReceiver();
-		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
+				&& !Config.CLOSE_TCP_WHEN_SWITCHING_TO_BACKGROUND) {
 			scheduleNextIdlePing();
 		}
 	}