Save the connection for the automatic log-in after the phone is booted

Hello all,

i’m new for android development and smack library, so i don’t know if the thing that you read on the title is possible (i guess yes because i see it happen on other chat app like whatsapp & co).

I would like to save the “connection” so when the user open the app, it is still logged. Moreover, i would like to do that the app run at the boot so when a user receive a new message, he see the notify.

Which class, metods and library should i use? Can someone link me a guide?

Thanks in advice! (and sorry for my bad english).