Testing Android background services during development without rebuilding app UI flows is accomplished using Activity Manager (am) commands via adb shell.
ADB Service Control Commands
# Start background service with Intent extras
adb shell am startservice -n com.example.myapp/.MyBackgroundService --es "action" "sync"
# Start Foreground Service (Android 8.0+)
adb shell am start-foreground-service -n com.example.myapp/.MyForegroundService
# Stop running service
adb shell am stopservice -n com.example.myapp/.MyBackgroundService
Comments and corrections