immich
immich copied to clipboard
feat(android) Check server is reachable before starting background backup
Add a check for android version that verifies that server is reachable before starting background backup and fail otherwise.
Why?
When server is behind VPN there is no reliable way to set constrains that would allow to start only for specific network. This results in backup work tries that hang up in notifications. One way to tackle this would be to start backup only when specific network is connected. Unfortunately it seems to be impossible when using VPN. Another option is to check that server url can actually be reached before trying to run backup.
This PR tries to accomplish this by opening HttpURLConnection and checking for 200 code.
Test? Tested and confirmed on Android device. Tested on iOS simulator that it doesn't break background backup start.
@alextran1502 Fixed iOS issue.
Thank you for the quick fix!