Inside my app I know that the connection is lost in this moment. What is the best way to send a http post request until get the internet connection back? An approach is to retry the request a few times, but is there something smarter?
What you can do is save your request on a database if connection fails (you can use any database, even shared preferences). Then implement a connection listener to listen if connection goes back. If connection goes back, get the request on the database and retry it again, if it succeeds delete that request on the database.
Saving the request is up to you on how you would want to group your request. For example, login request, you can save it on your table LOGIN_QUERY_TABLE with column username and password, if connection goes back, get the username and password to retry logging in again.