Feb
05
2011

How to make AIR for Android app movable to SD card

Just few weeks after I got my first Android smartphone - HTC Desire I faced running out of space issue. And then I started to appreciate all the apps that allow me to move them on SD card. If you are developing in AIR for Android, you can also include that option when publishing your app.


Although specs say that my phone has 576MB internal space, I actually have around 150MB to play with. This is because there are many preinstalled apps and widgets including HTC Sense. Then there are still plenty of applications that will not give you an option to move to SD card like Facebook or Fring. There are also apps like Adobe AIR (17MB) and Adobe Flash (12MB) that don't have that option and the reason is that if they were kept on SD card and you plugged your phone to a computer as disk drive or just removed your card then you wouldn't be able to experience Flash in your browser or run AIR apps that were installed on your internal memory. And if you also account temporary data and cache that is stored by most if not all of the apps on phone memory then you now see why the users run out of memory so quickly.

But you can make your application movable to SD card. This allows people to install more apps as they have usually more space on their SD cards than on internal memory. So if they are bored with your app/game they will not necessarily remove it to free up their space but at least move on SD...

This feature comes with Android Froyo also know as version 2.2. Generally you have three options, you can leave the users with no other option than installing on internal memory, installing on SD by default and allow the users to move to phone memory or installing on phone memory and leave option to move to SD.

In your application descriptor file find the <manifest> tag which should be inside <manifestAdditions> that is inside <android> tag. You can select one of the three scenarios by adding "android:installLocation" attribute.

Example:

<android>
  <manifestAdditions>
    <![CDATA[<manifest android:installLocation="auto">
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
      </manifest>]]>
  </manifestAdditions>
</android>

 

where uses-permission tag is irrelevant here, just left it for clarity as you probably would also have something there.

installLocation="auto" - application would install on internal memory but the users have an option to move to SD card

installLocation="preferExternal" - application by default installs on SD card and user can moved to phone

If you want users without any option and your app installed on internal memory, do not include installLocation attribute at all.

 

Comments 

 
+3 #1 Pat 2011-05-07 21:22
I wish every Android app had "move to SD card" option... Or we had more phone memory...
Quote
 

AS3 Tips

Follow me on Twitter