Call startForegroundService only when needed

This could reduce RemoteServiceException occurences

See #1197
1 job for !486 with service_start in 3 minutes and 20 seconds (queued for 1 second)
latest detached
Status Job ID Name Coverage
failed #365759
amd64 debian


Name Stage Failure
continuous-app-build Build
            > Could not HEAD ''. Received status code 502 from server: Bad Gateway

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at

BUILD FAILED in 2m 59s
ERROR: Job failed: exit code 1