I think i can divide the problem in 2 problems now. The first is the cpu going to sleep for a too long time sometimes causing timeouts on the server i think. I think i can resolve this by waking the device up and sending ping at the max time before the server times out.
My second problem is reconnecting when i detect a broken connection. I think the internal reconnectionmanager from smack is not very suitable for android. While the ReconnectionManager loops the cpu goes into sleep again and stops smack from reconnecting.
Together with the first problem: If the cpu starts working again after the server got a timeout because the connection was idle for too long and smack tries to go on with reconnection i got this:
org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:3 52)
org.jivesoftware.smack.TCPConnection.login(TCPConnection.java:236)
org.jivesoftware.smack.TCPConnection.connect(TCPConnection.java:883)
Saw this only 1 or 2 time a week testing my code. Don't have any more logs then that.
Solution for the second problem seems to disable the ReconnectionManager and do the reconnection attempts with the AlarmManager. I don't know if it is reasonable to integrate a special reconnection mechanism for android in smack itself?
Another small question on the side, is there anything to read about using XMPP extensions with smack? I am interested in message carbons.
Another thing i noticed is, if i type emoji smilies with the stock android keyboard (hold return) the connection goes down without any exceptions.