Decide what “headless” means for the job
A windowless emulator still runs Android and the app. A background task runs inside Android under its lifecycle rules. An extracted API client runs the recovered requests in another runtime. These are different deployment choices.
Use a windowless emulator when the workflow still needs the app process. Move recovered backend calls into a client when that is the right execution path. API-based automation explains that split. The buyer’s result can be the same daily report or completed workflow in either design.
Starting the emulator is only the first checkpoint
The Android emulator supports -no-window. That removes its desktop window; it does not remove the virtual display or make every app accept an emulator. The emulator command-line guide documents this option and startup settings.
emulator @your_avd -no-window -no-audio
This command needs an installed AVD with that name. After startup, check that Android has booted, the app is ready and the session is valid. A running emulator process proves none of those later conditions.
Make the job survive a restart
Store the job ID and progress outside the worker process. Use states such as queued, running, completed and failed. A restart can then find an interrupted job rather than forgetting it or silently starting another copy.
The owned checkpoint fixture uses SQLite. It creates a running job, closes the database to model a worker stopping, opens it again and completes the job. It writes output and the completion checkpoint in one transaction. Repeating completion leaves one output row.
That local test proves the fixture’s database behavior. A production workflow also needs the remote service’s retry rules. If a server completed an action but its reply was lost, use an operation ID or a status lookup to establish the result before repeating it.
Recover sessions without losing progress
Keep account state separate from job state. Refreshing a session should not reset a report cursor or repeat an earlier action. Save the last confirmed result and the next work item. After login recovery, resume from that checkpoint.
For a data job, compare the expected fields, record count and output format. For an action, check the final state in the service. A screenshot or a button tap is intermediate evidence; the finished result is the acceptance check.
Give failures a useful record
Log job ID, workflow step, attempt and outcome. Save app logs or screenshots when a failure needs them, while keeping credentials out of routine output. Set timeouts for startup and each remote operation so a failed run cannot wait forever.
Test interrupted connections, an expired session and a restarted worker before scheduling unattended runs. Measure resource use on the chosen host rather than promising that one execution method is always cheaper.
Deliver a workflow the business can run
The finished package includes the launcher, client or app worker, restart behavior and output delivery. Android workflow automation covers the service. For work that must run on a physical device without a host, see on-device automation.
Reviewed 22 October 2026 · SReverse research desk