When using Android phones, we found that someProgramAllowed to be moved to the SD card, but some cannot? Why?
Because Android 2.2 and later versions are allowed to be moved to the SD card. However, all applications developed earlier do not have this function.
So how can I allow your app to move to the SD card? The answer is actually very simple. You only need to set an installlocation attribute for manifest.
This property sets the default installation location, which has three valid values,Auto,Internalonly,Preferexternal.
Auto
Indicates automatic installation. The installation location is determined by the system.
Internalonly
Installed in mobile phone memory
preferexternal
installed in external storage
Take a look at the modified androidmanifest. xml.
<Manifest xmlns: Android = "http://schemas.android.com/apk/res/android" package = "com. yfz" Android: installlocation = "Auto" Android: versioncode = "1" Android: versionname = "1.0">
Is it easy?
Someone may ask, what if I want to support 2.1? In fact, you don't need to worry about it. You just need to set <uses-SDK Android: minsdkversion = "7"/> and then install it on the 2.1 device, Android ignores this attribute, install it directly to the phone memory.
Note that not all programs are suitable for moving to the SD card. Next let's take a look at the conditions under which programs are not recommended to be moved to the SD card.
Applications that shocould not install on external storagewhen the user enables USB Mass Storage to share files with their computer (or otherwise unmounts or removes the external storage ), any application installed on the external storage and currently running is killed. the system provided tively becomes unaware of the application until mass storage is disabled and the external storage is remounted on the device. besides killing the application and making it unavailable to the user, this can break some types of applications in a more serious way. in order for your application to consistently behave as expected, you shocould not allow your application to be installed on the external storage if it uses any of the following features, due to the cited consequences when the external storage is unmounted: servicesyour running service will be killed and will not be restarted when external storage is remounted. you can, however, register for the action_external_applications_available broadcast intent, which will modify y your application when applications installed on external storage have become available to the system again. at which time, you can restart your service. alarm servicesyour alarms registered with alarmmanager will be canceled. you must manually re-register any alarms when external storage is remounted. input Method enginesyour 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 wallpapersyour 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 foldersyour 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 widgetsyour 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 managersyour accounts created with accountmanager will disappear until external storage is remounted. sync adaptersyour abstractthreadedsyncadapter and all its sync functionality will not work until external storage is remounted. device administratorsyour 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. broadcast receivers listening for "Boot completed" the system delivers the action_boot_completed broadcast before the external storage is mounted to the device. if your application is installed on the external storage, it can never receive this broadcast. copy protectionyour application cannot be installed to a device's SD card if it uses Android Market's copy protection feature. however, if you use Android Market's application licensing instead, your application can be installed to internal or external storage, including SD cards. if your application uses any of the features listed above, you shoshould not allow your application to install on external storage. by default, the system will not allow your application to install on the external storage, so you don't need to worry about your existing applications. however, if you're certain that your application shocould never be installed on the external storage, then you shoshould make this clear by declaring Android: installlocation with a value of "internalonly ". though this does not change the default behavior, it explicitly states that your application shocould only be installed on the internal storage and serves as a reminder to you and other developers that this demo-has been made
It is important to see the above section. For example, if your program wants to start automatically, it cannot be moved to the SD card. Because the boot broadcast message boot_complete is sent before the SD card is loaded, the program cannot receive it.
Okay, that's all.
For more information, see here: http://www.cnblogs.com/over140/archive/2011/03/21/1989891.html