How to install an app on SD in Android

Source: Internet
Author: User

Environment: imx51 FSL Development Board System: android2.2

Method 1,

1. Connect to the debug serial port

2. Run PM setinstalllocation 2 in shell.

You can also execute: PM getinstalllocation to obtain the mode.

0 [auto]: Let system decide the best location
1 [internal]: Install on internal device Storage
2 [External]: Install on external media

 

3. Put the package you want to install in/sdcard and install it using es,

After installation: DF or busybox DF-H

Filesystem size used available use % mounted on
Tmpfs 210.5 m 12.0 K 210.5 m 0%/dev
Tmpfs 210.5 m 0 210.5 m 0%/mnt/ASEC
Tmpfs 1.0 m 28.0 K 996.0 K 3%/mnt/SHM
/Dev/block/mmcblk0p2 121.5 M 97.6 M 23.9 m 80%/System
/Dev/block/mmcblk0p5 239.6 M 37.0 M 190.2 M 16%/Data
/Dev/block/mmcblk0p6 121.6 M 5.5 m 109.8 M 5%/Cache
/Dev/block/vold/179: 1
3.2g 22.6 m 3.1g 1%/mnt/sdcard
/Dev/block/vold/179: 1
3.2g 22.6 m 3.1g 1%/mnt/secure/ASEC
/Dev/block/dm-0 2.0 m 28.0 K 2.0 m 1%/mnt/ASEC/COM. Kevin. slidingdrawer-1
/Dev/block/dm-1 2.0 m 32.0 K 2.0 m 2%/mnt/ASEC/Android. SerialPort. Sample-1
/Dev/block/dm-2 8.1 m 6.9 m 1.2 m 85%/mnt/ASEC/COM. Google. Android. Apps. Maps-1
/Dev/block/dm-3 2.0 m 876.0 K 1.2 m 42%/mnt/ASEC/COM. Alibaba rasoftworks. Quadrant. UI. Advanced-1

Where/dev/block/dm-0 to 3 is the APK app we installed on SD. As you can see (I have installed four applications on SD)

4. This only installs applications on SD, but their buffered data or temporary data are still in the/data directory, but the installed files do not occupy the flash space, the dynamic data or generated temporary data required for running is still in flash.

5. Disadvantages: this leads to a problem where startup slows down and the running of programs on SD is slower than that on flash. This requires that your SD card be fast enough!

6. Advantage: The system is broken, and these applications in SD do not need to be installed again.

Method 2,

Mainly for developers

1. For your program to support SD card installation, 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. The Code is as follows:

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

2. The values of Android: installlocation mainly include preferexternal, auto, and internalonly. 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.

 

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.