Android app losses connection

When it isn’t been used for a while and it takes sevral reloads for it to reconnect. is it possible to keep the connection alive when the app isn’t used?

You could bypass the rediscovery process by changing the network settings on your Android phone to have a fixed MAC address and fixed IP Address, and then updating your router DHCP settings to have a corresponding static IP address that it will use every time.

Allocate a Static IP Address for your HomeAssistant server also.

While any sessions will timeout when not being used, re-establishment should be quicker, especially if you update any code to use the static IP address URLs directly instead of DNS.

Check if you have “Suspend background connections” switched on.
To get to the setting, Click on your profile picture in the bottom left of the HA dashboard, then scroll down to the Browser setting at the bottom. Note that you will need to enable Advanced Mode to see the setting.