- Home /
Uninstall save directories from app?
I'm working on a android app that would download an assetbundle and store it on the sdcard. Is there a way to make sure this directory would be deleted if the app was uninstalled?
Answer by HazeTI · Apr 02, 2012 at 05:50 PM
I've found that if you place it in /Android/data//files then it will automatically be deleted on the app being uninstalled.
I was recommended to not save anything in there by my supervisor. I plan on saving it to sd due to the size.
Yes, that's still on the SD card. So the path would be something like /mnt/sdcard/.
You can use something like the following code:
if (isExternalStorageAvailable())
{
return Environment.getExternalStorageDirectory().getAbsolutePath()
+ "/Android/data/" + appContext.getPackageName() + "/files";
}
else
{
//return some appropriate error
}
that works really well then! Thanks. I'll put that in very soon! However, is getExternalStorageDirectory() from a plugin?
Ah sorry, that was from some Java code that I'm using. It's standard Android code but I'm sure Unity must have something similar. Try searching for "getExternalStorageDirectory" elsewhere in Answers or on the Forums I'm sure something will come up.
Apparently Application.persistentDatapath goes to the correct location
Your answer
Follow this Question
Related Questions
Can't Uninstall Unity 1 Answer
If I uninstall one copy of Unity will it mess up my other installations? 2 Answers
uninstall my unity pro? 0 Answers
Custom Unity action on Android Uninstall 0 Answers
Can't install unity web player on mac 2 Answers