Friday, January 21, 2011

Force Apps to Move to SD Card (on Froyo)

In my last post I've explained about how to make your application installable to SD Card. Later I found this great blog post about moving any other application to SD Card, without having the source code. After following those steps, you will be able to move (to SD) all the applications you downloaded and installed.

So this is not only for developers, but also for standard users:


Friday, January 14, 2011

How to Enable Move to SD Card Feature for Your App?

Well, because I was busy during last several months, I couldn't post anything to my blog. Now it's time to continue posting.

Today's issue is enabling the App2SD feature for an application. As you know, when Google introduced the Froyo, they clearly stated that it would have the App2SD. So it is, but with a difference. They made it up to developers to allow the application movement to the SD card. If the user has Android 2.2 installed on their device and you haven’t applied this tip, they’ll see an unuseful, grayed out, button when they try to move the application to their SD card. Developers must specifically enable this feature within their applications.

Now it's time to learn how to do it for our applications, i will explain step by step.

First we should modify your Manifest file as follows to add android:installLocation entry to the <manifest> tag:

   <manifest xmlns:android=""

We set the value to “auto” so that the users of our application will be able to decide where to install the application. Another possible values could be “internalOnly” which is the same as the behavior without this setting, and “preferExternal,” which will install the application on the SD card first, if it’s available.

After we set the installLocation key, we will get the following error:

error: No resource identifier found for attribute ‘installLocation’ in package ‘android’ 

This is because we didn't target our project to API Level 8. If we don't target the application to API Level 8, it can't have the App2SD feature. In order to do this we must change the project property "build target". Simply navigate to Properties (right-click on the project in Eclipse) and choose a target with at least API Level 8.

Now our application is ready to move to SD Card of any Android 2.2 device.

Load the application to a 2.2 device or emulator, then navigate to application management. You will see the "Move to SD" button enabled for the application.