Friday, May 4, 2012

Android - How to Enable "Move to SD card" feature in android?


Android - How to Enable "Move to SD card" feature in android?


Android 2.2 supports application installation on external storage devices like the SD card. This should give users room for many more apps, and will also benefit certain categories, like games, that need huge assets.
The “Manage Applications” screen in the Settings app now has an “On SD Card” tab. The sizes listed in Manage Applications only include the space taken by the application on internal storage.
The Application Info screen now has either a “move to SD card” or “move to phone” button, but this is often disabled. Copy-protected apps and updates to system apps can’t be moved to the SD card, nor can those which are don’t specify that they work on the SD card.
To allow the system to install your application on the external storage, modify your manifest file to include the android:installLocation attribute in the element,android:installLocation => It defines the location where the application will install. It takes one values from the 3 values as shown below:
If you declare "auto", you indicate that your application may be installed on the external storage, but you don't have a preference of install location. The system will decide where to install your application based on several factors. The user can also move your application between the two locations.
If you declare "internalOnly"  Install the application on internal storage only. This will result in storage errors if the device runs low on internal storage.
If you declare "preferExternal", you request that your application be installed on the external storage, but the system does not guarantee that your application will be installed on the external storage. If the external storage is full, the system will install it on the internal storage. The user can also move your application between the two locations.
Note: In order to compile your application, change your build target to API Level 8. This is necessary because older Android libraries don't understand theandroid:installLocation attribute and will not compile your application when it's present. So change the build target by editing the project properties (right-click on the project in Eclipse), and choose a target with at least API Level 8.


No comments: