[{"data":1,"prerenderedAt":20},["ShallowReactive",2],{"blog-post-en-reset-android-phones-clean-state-phoma":3},{"slug":4,"lang":5,"title":6,"summary":7,"date":8,"tags":9,"tag_slugs":15,"thumbnail_url":16,"translations":17,"body":18,"asset_base":19},"reset-android-phones-clean-state-phoma","en","Reset Android Phones to a Clean State Between Phoma Runs","Clear app data, force stop processes, and dismiss onboarding so every Phoma flow starts from the same baseline on shared test phones.","2026-11-22",[10,11,12,13,14],"android","testing","phoma","flows","device-baseline",[10,11,12,13,14],"https://blog-api.phomaapp.com/api/blog/posts/reset-android-phones-clean-state-phoma/thumbnail.svg?lang=en",[5],"## Why a clean baseline matters\n\nWhen you run the same Phoma flow on a phone every day, or share one phone across a QA team, leftover state becomes the enemy. A draft form saved yesterday, a notification dismissed this morning, or a toggle left on from a previous test can make a flow fail for reasons that have nothing to do with the app under test.\n\nA clean baseline means the app starts from the same first-run or login screen every time, local data is cleared, background processes are stopped, and OS-level settings that affect the app are back to a known starting point. Phoma flows run on your own Windows PC and your own Android phones, so you control the reset completely and there is no limit on how many phones or flows you use for free.\n\n## Why a logout button is not enough\n\nMany testers try to reset by logging out of the app and calling it done. That usually is not enough. Logging out often keeps the local database, cached images, shared preferences, and notification channels intact. The next run can still resume a session, restore a draft, or skip a screen because a flag was saved locally.\n\nFor a reliable baseline, you want to clear the app's storage, force stop its process, and then reopen it so Android creates a fresh process. If the app shows onboarding or permissions on first launch, your reset flow should dismiss those too, so the test flow begins at the same screen every time.\n\n## Building the reset flow in Phoma\n\nSince Phoma is visual and has no public API, SDK, or CLI, you build this as a normal flow in the desktop app. Each action is a step you add in the visual builder: Open app, Tap element, Wait for element, Read text, and Screenshot. You do not write code.\n\nHere is a step sequence that works for most test apps.\n\n```\n1. Open the Android Settings app.\n2. Navigate to Apps, then See all apps or App info, and select the app under test.\n3. Tap Storage and cache, then Clear storage or Clear data, and confirm with OK.\n4. Tap Force stop and confirm.\n5. Open the app under test from the home screen or launcher.\n6. Wait for the first-run or login screen to appear.\n7. Dismiss onboarding, permission prompts, or welcome dialogs using tap steps.\n8. Add a text assertion or screenshot checkpoint that confirms the baseline screen is visible.\n```\n\nWhen you tap Clear storage, add a short Wait for element step before tapping OK, because the confirmation dialog can take a second to render. Phoma will not click ahead of the UI, so waiting keeps the flow reliable on slower devices.\n\n## Choosing selectors that survive updates\n\nSettings screens differ between phone manufacturers and Android versions. One phone may say Storage and cache while another says Storage. To keep your reset flow from breaking after an OEM update or a phone swap, choose stable selectors.\n\n- Prefer resource-id or content-desc over visible text when the element exposes one.\n- Avoid index-based selectors such as the third button in a row; if a new menu item is added, the index shifts.\n- Use Wait for element before tapping Clear storage so Phoma does not click the wrong screen while Settings is still loading.\n- Use Read text or a screenshot checkpoint after the reset to confirm the app is actually at the baseline, not just that the tap step completed.\n\n```\nGood: resource-id='com.example.app:id/clear_storage_button'\nAvoid: index='3'\n```\n\nIf your team uses several phone models, keep one reset flow per model family or parameterize the screen text with condition steps so the same flow can branch based on what is on screen.\n\n## Real-world example: field inspection app\n\nA QA team tests a field inspection app on five shared Android phones. Testers fill out inspection forms, attach photos, and toggle offline mode. Without a reset, the second tester sees the first tester's draft inspection, and the flow fails because the app resumes the draft instead of showing the new-inspection screen.\n\nThe team created a Phoma reset flow that opens Settings, clears the inspection app's data, force stops it, relaunches the app, taps through the welcome screens, and asserts that the New Inspection button is visible. They run this reset flow before every smoke test on each phone. Because Phoma supports running one flow on many phones at once, the team can reset all five devices in a single run, then start the actual test flow.\n\nThe result is fewer false failures and no time spent asking whether a failure was caused by a bug or by leftover data from the previous tester.\n\n## Running the reset across your device lab\n\nEverything on your own phones is free with no limit on phones or flows. Team and Business plans are for sharing phones and flows inside a team.\n\nRun the reset flow:\n\n- Before each test suite, so every device starts identical.\n- After each test run, so the phone is clean for the next person.\n- On a schedule for devices that stay plugged in overnight, if your team uses unattended runs.\n\nBecause the flow runs on your Windows PC and talks to your phones directly, there is no cloud device farm involved and no per-device minute metering for local use.\n\n## Troubleshooting common reset problems\n\nClear storage is grayed out: This can happen for system apps or apps with device-admin privileges. Only run this reset on test builds or apps your team installs, not on system applications.\n\nThe confirmation dialog never appears: Add a Wait for element step for the OK button before tapping it. If Settings is slow on a particular phone, increase the wait rather than adding repeated tap steps.\n\nThe phone is locked when the flow runs: Phoma controls the screen while mirroring, but if the device locks between steps, taps may not register. Keep test phones unlocked during automated runs or add an unlock step at the start of the reset if your security policy allows it.\n\nMultiple users or work profiles: Clear data for the user profile that the test flow actually uses. If the app is installed in a work profile, the Settings path may differ slightly.\n\nThe app shows a different first-run screen after an update: Update the tap steps in the reset flow to match the new onboarding, and add a screenshot checkpoint so the failure is obvious immediately.\n\n## What not to automate here\n\nDo not use this approach to root phones, install custom ROMs, or modify system partitions. Phoma is designed for standard Android devices with USB debugging enabled. Do not automate the creation of many accounts or use the reset flow to bypass app protections. The goal is a repeatable baseline for legitimate QA and repetitive operational tasks, not to evade an app's terms.\n\n## A clean phone makes a trustworthy test\n\nResetting to a known state is one of the highest-return automation habits a QA team can build. It takes one Phoma flow to clear app data, stop the process, dismiss onboarding, and verify the baseline screen. Once that flow exists, every subsequent test flow is easier to trust because you know exactly where the phone started.\n","https://blog-api.phomaapp.com/api/blog/posts/reset-android-phones-clean-state-phoma/assets",1796035639371]