How to keep connection alive in smack 4?

I found the keepalives feature in Smack 3.X by sending a whitespace to server.

But it seem to be removed from 4.X.

It’s important feature for mobile app , How can I do it on 4.x?

That job is done by PingManager in Smack 4. On Android I recommend using ServerPingWithAlarmManager (SMACK-NIGHTLY-JOB1 4.1.0-beta2-SNAPSHOT API)

Thanks for your help.

Is it available in Smack 4.0.x?

BTW:

The PingManager seem using xep 0199, That’s required supporting by server side.

And more heavy than just send a whitespace.

What’s the extra benefit from the change?

The PingManager seem using xep 0199, That’s required supporting by server side.

No it’s not required, because the server MUST respond to iq requests.

And more heavy than just send a whitespace.

What’s the extra benefit from the change?

  • Not having to maintain the nearly same functionality twice

  • Pings are replied to with Pongs