How to catch silent disconnections?

Hi, is there any other way other than repeatedly pinging the server to prevent Smack from silent disconnecting or receive an error in such situation?

It would be really useful if Smack would be able to call connectionClosed and connectionClosedOnError in all cases when connection is closed.

I saw several posts and observed similar issues where connection is not being kept alive, especially during sleep mode. For example: 57249, 57589

If that would work as expected then silent disconnections would not be a problem.

Recently I came across the presentation regarding the XMPP and Android made by Florian Schmaus from Ignite Realtime available here: https://archive.fosdem.org/2015/schedule/event/xmpp_and_android/attachments/slid es/749/export/events/attachments/xmpp_and_android/slides/749/xmpp_and_android.pd f

On page number 25 (slide number 11) the following sentence is present:

If the connection silently breaks, i.e. no SIGPIPE, then there is nothing

you can do to detect that besides draining the battery by increasing the

ping interval.

It looks the presentation was created at the end of January 2015 so a few things could change in time.

I’m using Smack in version 4.1.5.

I would appreciate any help or discussion in this matter.