You need to use the application and configure it in a way that it doesn't disconnect you on idle. This can be done from the settings menu. Another cause to this issue is the fact that you are too far away from the WiFi signal and you receive only small frequencies of the signal. This can be fixed by approaching the WiFi source.