Install Android APK on SD card

Source: Internet
Author: User

Android 2.2 software can be installed on SD for support, ADB commands have also been improved, for Android 2.2 firmware PM command support installation option parameters, the setinstalllocation parameter is added here. Here we can use ADB to execute the Linux PM command to add some parameters, such as ADB shell PM setinstalllocation 0. The last parameter 0 indicates auto. The Android system automatically selects this parameter, while 1 indicates the ROM inside the mobile phone and 2 indicates the external SD card storage. The main explanation is as follows:

 
ADB shell PM setinstalllocation
Option

The option value can be the following number

0 [auto] Let the system decide. Automatic

1 [internal only] rom

2 [External] SD card

Here, android123 recommends that you install frequently used small software on your mobile phone, such as call management and system tools, to provide higher reliability and reduce power consumption, for game applications, you can consider installing the APK on the SD card. For APK files larger than 4 MB, you can consider installing the APK on the SD card.

ADB shell PM setinstalllocation 2

Of course, the android Development Network reminds you that the new installation location parameter getinstalllocation is available. We use ADB shell PM getinstalllocation to obtain the installation location list of the software.

 

 

The new feature in Android 2.2 supports app2sd cards. Our APK files can be installed on the SD card for users to use. Today, android123 describes the upgrade and configuration of the current project.

1. First let yourProgramTo install the SDK, you must set the API level to at least 8, that is, androidmanifest. in XML, Android: minsdkversion should be at least 8. In this way, your APK will be compatible with only 2.2 of the firmware during the final running, and the firmware will be available in androidmanifest. the Android: installlocation attribute must be added to the root node of the XML file, similarCodeAs follows:

<Manifest xmlns: Android = "http://schemas.android.com/apk/res/android"
Android: installlocation = "preferexternal"
...>

2. android: installlocation values mainly include preferexternal, auto, and internalonly options. We usually set preferexternal to recommend that applications be installed on the SD card, of course, the end user can choose the internal ROM storage. If the external storage is full, Android will also install it on the internal storage, and auto will adapt according to the storage space, of course, some applications may have special purposes. They generally have to be installed in internal storage to run reliably. It is more appropriate to set internalonly, mainly because:

Services
Your 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. android123 reminds everyone that real-time background monitoring applications should be installed in internal storage, which is relatively reliable. .

Alarm services alert service
Your alarms registered with alarmmanager will be canceled. You must manually re-register any alarms when external storage is remounted.

Input Method engines Input Method Engine
Your 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 wallpapers activity Wallpaper
Your 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 folders active folder
Your 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 widgets widget
Your 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 Managers Account Management
Your accounts created with accountmanager will disappear until external storage is remounted.

Sync adapters synchronization Adapter
Your abstractthreadedsyncadapter and all its sync functionality will not work until external storage is remounted.

Device administrators Device Manager
Your 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.

which applications are suitable for SD card installation? Android Development Network recommends that games that occupy a large amount of resources, such as a single file larger than 3 MB, do not need to reside in memory for a long time, apps that do not have reminder and real-time monitoring are generally placed on the SD card. However, if you want to install your apps on the SD card, you must set the API level to at least 8, android: installlocation is also displayed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.