Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*/
package ti.modules.titanium.app;

import static android.content.Context.ACTIVITY_SERVICE;

import org.appcelerator.kroll.KrollModule;
import org.appcelerator.kroll.KrollRuntime;
import org.appcelerator.kroll.annotations.Kroll;
Expand All @@ -17,6 +19,7 @@
import org.appcelerator.titanium.proxy.RProxy;

import android.app.Activity;
import android.app.ActivityManager;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
Expand Down Expand Up @@ -61,6 +64,13 @@ public ActivityProxy getTopActivity()
}
}

@Kroll.method
public Boolean clearUserCache()
{
return ((ActivityManager) TiApplication.getInstance()
.getSystemService(ACTIVITY_SERVICE)).clearApplicationUserData();
}

@Kroll.getProperty
public int getAppVersionCode()
{
Expand Down
5 changes: 5 additions & 0 deletions apidoc/Titanium/App/Android/Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ properties:
permission: read-only
since: 3.3.0

methods:
- name: clearUserCache
summary: Clears app data and cache. This will close the app.
since: 12.8.0

events:
- name: shortcutitemclick
summary: Fired when a <Titanium.UI.ShortcutItem> is clicked.
Expand Down
Loading