Appcelerator : move Android application on SD card
When I Start mobile development with Appcelerator, I discovered a few tricks and I decided to share them on this blog!
For this first posts series, I’ll show you how to move a part of your Android application on the SD card.
Like many, I have a Android phone (Google Nexus) with a limited storage space for applications and size of Appcelerator applications are 3Mo minimum, because it embed the Titanium mobile javascript framework.
Fortunately, since the Android version 2.1 (API 7), it is possible to move some files (images, videos, etc …) on the SD Card, if present.
To do this, simply declare it in the file tiapp.xml which is on the root of your Titanium application:
Step 1
Open file tiapp.xml on the root of your Titanium Studio project.
Step 2
Click on tiapp.xml tab, in the bottom of the form for editing the XML.

Step 3
Add this code in Android section:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>8</tool-api-level>
<manifest android:installLocation="preferExternal">
<uses-sdk android:minSdkVersion="7" />
</manifest>
</android>
Step 4
Save and launch Android emulator to test to move your application on SD.
Step 5
When emulator is started and your application launched:
- Quit your application to view the Android homescreen
- Click button Menu of emulator
- Choice in the menu Settings -> Applications -> Manage applications
- Click on your application to view properties
You should have the following screen:

Step 6
Now, just click on Move to SD card and should see this :

The handling is quite simple and disk space gain may be important if your application has pictures and videos but it’s not possible actually to go under 3Mo (SDK 1.7.2).
Feel free to post comments on this article and what you want for the next.


Loading...
Bonjour, je suis Damien Laureaux, développeur d'applications web et mobile chez IOcean.