[Guide] Android Applications on SD Card – How and Why?

If you’ve ever been greeted with an ‘Running Low on Storage Space’ notification, this can be extremely frustrating. Many realise by know one of the main drawbacks in the current iteration of the Android 2.1 OS is the limitation on application storage space to the internal ROM, which I mentioned in my earlier article. This is generally a 512MB space, or 256MB in older generations of Android devices. Once the OS itself is installed and cache generated, this space can reduce dramatically to around 140MB (or 30MB on older devices), which yields enough space for around 100-120 average applications.

As programs become more complex, their space requirements generally increase. The biggest culprits are games (which require lots of space for texture storage) or badly programmed applications. GPS apps are generally keep their maps on the SD card out of necessity. But with the introduction of Android 2.2 (which is being rolled out at the moment), the ability for users to store applications on the micro SD card (referred to as external storage) is a much welcomed, as it offers basically limitless, cheap and interchangeable storage. But how exactly does it work and how do you control it?

How do I move existing apps between phone <=> SD Card?

By default in Android 2.2, applications are stored on the internal memory until it’s full, then the external memory starts to fill up (this is known as automatic installation location). However, if there are apps you specifically want to move to SD card, then this is fairly straightforward, go to Settings => Applications => Manage Applications. A new and improved list appears, dividing your current apps between ‘Running’, ‘On SD Card’, ‘Downloaded’ and ‘All Apps’. By clicking on individual tasks, you can choose to stop them, uninstall them, or move them in between storage locations (even while they are running). Easy right? If for some reason you wanted to have a quick shortcut to this Manage Applications menu on the homescreens, you can make a custom shortcut using a program like BetterCut.

How do I check how much space I have left?

To check the existing space on your internal ROM storage, go to Settings => SD Card & Phone Storage and view the available Phone Storage there. Note that if you are too low on storage and the warning icon appears, you will be unable to install any new apps or create new content on the ROM.

What apps can I move to SD Card?

Note that not everything should be moved to SD card. The reason being system critical applications and widgets should always be kept on the internal ROM. When you plug your phone into the PC and mount it as a USB disk, it will dismount the SD card from the phone, rendering the phone unable to reach the applications there for that time period. In addition, the SD card is initialised later on the boot up sequence, so if these apps are moved to SD card, then strange behaviour occurs such as missing icons. According to Google itself, the following applications should not be kept on SD card:

Your running Service will be killed and will not be restarted when external storage is remounted. You can, however, register for theACTION_EXTERNAL_APPLICATIONS_AVAILABLE broadcast Intent, which will notify your application when applications installed on external storage have become available to the system again. At which time, you can restart your Service.
Alarm Services
Your alarms registered with AlarmManager will be cancelled. You must manually re-register any alarms when external storage is remounted.
Input Method Engines
Your IME will be replaced by the default IME. When external storage is remounted, the user can open system settings to enable your IME again.
Live Wallpapers
Your running Live Wallpaper will be replaced by the default Live Wallpaper. When external storage is remounted, the user can select your Live Wallpaper again.
Live Folders
Your Live Folder will be removed from the home screen. When external storage is remounted, the user can add your Live Folder to the home screen again.
App Widgets
Your App Widget will be removed from the home screen. When external storage is remounted, your App Widget will not be available for the user to select until the system resets the home application (usually not until a system reboot).
Account Managers
Your accounts created with AccountManager will disappear until external storage is remounted.
Sync Adapters
Your AbstractThreadedSyncAdapter and all its sync functionality will not work until external storage is remounted.
Device Administrators
Your DeviceAdminReceiver and all its admin capabilities will be disabled, which can have unforeseeable consequences for the device functionality, which may persist after external storage is remounted.

So there you have it, any system or critical application, keep it on the phone. Anything else is then safe to move to SD card. Note that by default, application developers are able to specify in their application a ‘preferred’ location for application installation. This does not need to be conformed to by your phone as it can override this preference or you can move apps around later as above. See here:

Application developers can express the preferred installation location for their applications by means of a new attribute of <manifest> in the manifest file,android:installLocation. The attribute supports three values: "internalOnly""preferExternal", and "auto". At install time, the system checks the value of android:installLocation and installs the application .apk according to the preferred location, if possible. If the application has requested external installation, the system installs it into a private, encrypted partition in the external media. Once an application .apk is installed externally, the system lets the user change the storage location of the .apk and move it onto the device’s internal memory if needed (and vice versa), through Manage Applications in the user settings.

By default, the system installs all applications onto the device’s internal memory, except for those that explicitly request external installation. This means that the system will always install legacy applications onto internal memory, since they do not have access to the android:installLocation attribute. However, it is possible to configure and compile a legacy application such that it is installed internally on older versions of the platform and externally on Android 2.2 and later platforms, if necessary.

Note that requesting installation onto the device’s external media is not suitable for all applications, particularly because the external media may be removable and unmounting/remounting may disrupt the user experience and system settings.

Is this different to Apps2SD?

Early implementations of third-party ROMs on ROM starved devices such as the G1 resorted to using Apps2SD, which redirects program storage to a pre-formatted EXT2/3 (and later EXT4) partition set aside specifically on the SD card of a user defined size. This worked fairly well and invisibly, with the added benefit of your programs staying exactly where they were, not requiring re-installation, in between changing ROMs (which was very hand when I was ROM swapping on the HTC Hero). However, 2.2’s app management is not Apps2SD, and it uses a different type of system. From what I gather, it creates an encrypted file/folder on the main partition on the SD Card and stores programs there, instead of a separate partition.

What’s the low down?

Bottom line is, after an upgrade to 2.2, this process should be invisible to the user. Only those that want to manually tweak installation locations can do it easily through application management. Unfortunately, Android is not yet smart enough to know which applications will not function correctly on SD Card, so it’s up to user discretion to decide.

Has this helped you? Leave a comment!


3 thoughts on “[Guide] Android Applications on SD Card – How and Why?

  1. I can’t browse my installed important applications in absence of SD Card. Please advise by email what kind & how much GB. SD Card should be inserted to my Samsung Gallaxy Pocket Android Phone, Model No: GT—S5300. and oblige thereby.

  2. Thanks for explanation.
    I was figuring out how to move some Apps to the SD card on my Motorola Cliq, but it wasn’t supportes, so, I rooted it, installed Cyanogenmod 7.0.1 (wich installs Android 2.3.7 instead of be stuck with 2.1), installed some apps, then I moved to SD, then my phone started crashing right after booting.
    I’ll use App2SD instead.
    Thanks Again.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s