The following content is mainly referred to from the official website description.
Starting with Android API-8, Android allows you to install an application into an external storage space (e.g. SD card), you can add Android to Androidmanifest.xml: The InstallLocation property to declare where the app is installed. If you do not declare the Android:installlocation attribute, your app will only be installed in the internal storage space and cannot be moved to the SD card by default. In order for the system to be able to install your application into external storage, you can set the value of InstallLocation to Auto or preferexternal in the Androidmanifest.xml file.
Such as:
<manifest xmlns:android="Http://schemas.android.com/apk/res/android"
android:installlocation="Preferexternal"
... >
。
If you declare the InstallLocation property as Preferexternal, your app will be required to be installed in an external storage space. Even if the system still does not guarantee that your application will be installed to external storage, if your external storage is full, your application may still be installed on your internal storage. The user can still move the application within the internal storage space and the external storage space.
If you declare the InstallLocation property as auto, your application may be installed in an external storage space, but you do not specifically install the location, depending on a number of factors to determine the location of your application installation, Of course the user can also move the application between the internal storage space and the external storage space.
When your application is installed in an external storage space, you need to know the following points
1, installing the application into an external storage space does not affect the performance of the program as long as the external storage is mounted on the device.
The 2,apk file will be stored in an external storage space, but the user data, database, DEX files will still be stored in the internal storage space after the extracted local code.
3, the application is unique to the application container, which is an encrypted random number that can only be decrypted through the application's original installation location.
4, the user can move the application to internal storage through system setup.
It is important to note that when a user shares a file via USB mass storage or SDcard unmount through a system setup, the external storage will be unmount from the device, and the running application that is installed in the external storage space will be killed.
An application can be installed to an external storage space this feature can only be applied to devices with API version 8 and above. Under 8, the application will be installed into the internal storage space and cannot be moved to external storage. Since most of the current device API versions are usually below 8, there is no explanation for the API version less than 8.
Applications in the following scenarios should not be installed in an external storage space.
When a user shares a file with a computer via USB mass storage, any application that is running and installed on the external storage will be kill.kill by the application, sometimes not visible to the user, in which case the application will be killed. If your application has the following characteristics and you want your application to run as you expect, you should not install the application to an external storage space.
1,services.
The running service is kil off and will not restart when the external storage device is re-mounted. But you can register the action_external_applications_available broadcast via intent, which notifies the external storage of the application system that is installed on the external storage and can be used again, then you can restart your service.
2.Alarm Services
The alarms registered through Alarmmanager will be canceled and you must manually register it again when the external storage is re-mounted.
3,input Method Engines
Your input method will be replaced by the default input method. When the external storage is re-mounted, the user can reactivate it by the system settings.
4,live Wallpapers
This is similar to the 3rd scenario above, the running live wallpaper will be replaced by the default wallpaper, and when the external storage is re-mounted, the user can select the live wallpaper again.
5,app Widgets
Your app widgets will be removed from the desktop. When external storage is re-mounted, your app widgets is still unavailable unless you reset the desktop app.
6,account Managers
Accounts created through Accountmanager will disappear until the external storage is re-mounted
7,syn Adapter and Device Administrators (temporarily not understood)
8,broadcast receivers listerning for "boot completed"
Because the system sends action_boot_completed broadcasts before external storage is mounted, applications that are installed externally are not receiving this broadcast as a boot broadcast.
Android about InstallLocation