Storing files on SD Card

Storing files on SD Card

May 03

Ever since I started using Android – I always thought it was a bit chaotic how different app developers handled their files differently when storing them onto the SD Card.
After using my phone for a few weeks, my root directory had about 10-15 random folders and I felt bad deleting them because I wasn’t sure what they were.

When I started developing, I dug through my SD Card and noticed within Android/data there was a nice structure of google/android applications with their java-style package name (like com.google.android.apps.maps)
So I stole this pattern and used it for my apps – storing all my cached images/files etc under Android/data/com.jamesgiang.xyz

My suggestion to all you developers out there, if you aren’t doing this already - please adopt this habit!

Why? Because I just found out that, if the user is running Android 2.2 or above, this directory will be automatically deleted when they uninstall your application.
Although user’s uninstalling your application is  a bad thing, as an Android user as well, having random folders sitting around your SD card can be pretty annoying.

Read more about it here on Android Developers

Leave a Reply