Allow your android program to support the app2sd function of the 2.2 edition System

Source: Internet
Author: User

App2sd is a new feature supported by android2.2 (frozen yogurt ).ProgramInstall it on the memory card and only keep some necessary files in the phone memory (ROM.

To support this feature in your own program, you need to set build target to 2.2 (or higher) when creating a project ):

Note: Although 2.2 is specified here, it does not mean that our program will only run in systems above 2.2. the min SDK version below can set the lowest compatible API level, if it is set to 4, it can be compatible with the lowest version 1.6.

During development, be careful not to use APIs not available in version 1.6 to ensure compatibility. After real-machine testing, users of lower-version systems will not notice any exceptions during installation and use.

(To avoid using incompatible APIs accidentally, we recommend that you modify the build target attribute after project development. You can right-click the project and select the properties menu item, in the settings window, select the android item on the left and then set the build target on the right .)

The next step is to open the androidmanifest. xml file of the program. You may see the following warning on the left side:

This simply means that our build target and Min SDK version are not uniform, so we don't need to worry about it.

We add attributes to the manifest element:

Android: installlocation="Preferexternal"

After adding it, it looks like this:

Then compile and release the APK. During installation, the program will be automatically mounted to the memory card.

If the above property value is set to Auto, the program will automatically determine the installation location based on the memory (ROM) Capacity of the mobile phone, and the user can manually change the installation location after installation.

after testing, a kb program occupies KB of mobile phone memory (ROM) after installation .; A masterpiece like Angry Birds, 14.1 MB, occupies 1.89 MB of mobile phone memory (ROM) after installation.

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.