Skip to content

feat(android): clearUserCache method #14213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

feat(android): clearUserCache method #14213

wants to merge 2 commits into from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented May 1, 2025

Add new method Ti.App.Android.clearUserCache() to clear the user data and app cache. It's basically the same as going into the app info menu - cache - clear data. It will close the app.

var win = Titanium.UI.createWindow({});
win.open();
var btn = Ti.UI.createButton({title:"clear"})
win.add(btn);
btn.addEventListener("click", function(){
	console.log(Ti.App.Android.clearUserCache());
})

Copy link
Contributor

@prashantsaini1 prashantsaini1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will perform the Clear Data action rather than the Clear Cache. Curious to know when someone would want to do this with their app?

@m1ga
Copy link
Contributor Author

m1ga commented May 15, 2025

Correct. As mentioned in the docs Clears app data and cache so the whole app will be reset. It might be useful if you have user data that you want to clear completely and want to start with a fresh app. I've used it a lot on apps during debugging. Having it in the app would speed up that process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants