@mister_monster
I am using key based auth, but I think it may be harder to do that because of android 9 background app sistem. I've enabled other apps to ignore battery optimisation and they still fail to do their tasks as intended. For example I'm using Nextcloud to sync my contacts, calendar etc and it fails to do scheduled task even with battery optimisation off. Thanks for advice anyway
@nikolal That is probably caused by your device itself lowering power by turning off networking when the screen is off. I am not sure where to change that in Android 9 but you can turn it off so that wifi stays active even when the device is idle.