Reference

clearApplicationUserData()

An Android ActivityManager method that erases an app's private data: databases, shared preferences, files, and caches under its data directory. It is the API behind the system's 'Clear storage' / 'Clear data' button and resets the app to a freshly installed state.

Android developmentAndroid

clearApplicationUserData()

Also known as: clear app data api, wipe app data android, android clearapplicationuserdata, ActivityManager clearApplicationUserData

An Android ActivityManager method that erases an app's private data: databases, shared preferences, files, and caches under its data directory. It is the API behind the system's 'Clear storage' / 'Clear data' button and resets the app to a freshly installed state.

  • Lives on android.app.ActivityManager and powers the system 'Clear storage' button.
  • Wipes databases, shared_prefs, files, and cache — resetting the app to first-install state.
  • An app may only clear its own user data; the process is killed during the wipe.

What it clears

ActivityManager.clearApplicationUserData() removes everything the app stored in its private data directory: the SQLite databases, shared_prefs, files, and cache folders, plus app-specific external cache. The app is effectively returned to its just-installed state, the same outcome as tapping Settings > Apps > [App] > Storage & cache > Clear storage.

For security, an app can only clear *its own* data; calling it triggers the system to kill the process and wipe the directory. The method returns a boolean indicating whether the clear was scheduled, not whether it has completed.

Clear data vs. clear cache

This API is the heavyweight option. Clear cache only deletes the reclaimable cache subfolder and leaves logins, settings, and saved content intact. Clear data (this method) is destructive: it also wipes databases and preferences, so the user is logged out and any local content is gone.

Storage cleaners surface this distinction because users often want the safe path. A cleaner clears cache and junk to free space without data loss, and only points users to full 'Clear storage' when an app's system data has bloated beyond what cache clearing can recover.

Related terms

Keep reading the reference.

Act on it

Guides and tools for this topic.