Answering well after a while, but maybe he will point someone in the right direction.
After some time searching, I find out that aSmack does not provide any offline storage.
To send a message when the sender is offline, we need offline storage to store the message until the sender returns to the network. I used sqlite for this, but SharedPreferences would also be a good option if we need to delete the message after sending it successfully.
The best solution that I follow is to insert a message in sqlite , save its id in shared preferences , send a message, and then remove the id from shared preferences . While if the intenet connection drops or the message cannot be sent for any reason, then we will use its id in the general settings as a backup. After accessing the Internet, we can go through shared preferences to check if any message has been sent.
source share