Skip to main content

clearData

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Delete an app's data and leave it installed — the state of a fresh install, without reinstalling. These call app_clear_data.

clearData​

public Map<String, Object> clearData(String app)
public Map<String, Object> clearData(String app, Path bundle)

Deletes an app's data and leaves it installed — a fresh install's state, without reinstalling. The answer holds emptied, kept and, on Android, still_granted: pm clear revokes the runtime permissions the user granted. An iOS simulator keeps its privacy grants and keychain; a real iPhone refuses.

@param app the package name (Android) or bundle id (iOS) @return what was emptied and kept, and on Android what is still granted

Resets an app on a real iPhone, which cannot clear one in place: it is uninstalled and installed again from its own bundle. Its data container is read back empty, and its privacy permissions, which nothing outside the app can read, are listed under not_read_back. Any other device refuses a bundle, since it clears in place.

@param app the app's bundle id @param bundle the app's own .app or .ipa @return what was emptied, and what was reset and not read back

Examples​

Delete an app's data, and keep it installed​

Map<String, Object> result = device.clearData("com.example.shop");
System.out.println(result.get("emptied"));