Android modifies the app's default installation location

Source: Internet
Author: User

<span style= "FONT-SIZE:14PX;" ><span style= "font-family:arial, Helvetica, Sans-serif; Background-color:rgb (255, 255, 255); " >google default Packagemanager, the corresponding definition of the application androidmanifest.xml is read </span><span style= "font-family:arial, Helvetica, Sans-serif; Background-color:rgb (255, 255, 255); " >installlocation</span><span style= "font-family:arial, Helvetica, Sans-serif; Background-color:rgb (255, 255, 255); " >:</span></span>


The rules are as follows:

1. If the installation location is not defined, it is installed on the phone memory;

2. android:installlocation = "auto", first check the phone memory is sufficient, if enough is installed in the phone memory, not enough to install on the T card;

3. android:installlocation = "internalonly", which means the device is installed on the phone memory;

4. android:installlocation = "preferexternal", means installed on the T card;


How do I add the "Choose App Install Location" feature in the settings to let the user choose the default installation location?

Modify the following file:

<span style= "FONT-SIZE:14PX;" >frameworks/base/packages/settingsprovider/src/com/android/providers/settings/databasehelper.java</span >

Make the following changes:

<span style= "FONT-SIZE:14PX;" >loadsetting (stmt, global.set_install_location, 0);</span>

Instead:

<span style= "FONT-SIZE:14PX;" >loadsetting (stmt, secure.set_install_location, 1);</span>



<span style= "FONT-SIZE:14PX;" >loadsetting (stmt, Settings.Secure.SET_INSTALL_LOCATION, 0);</span>

instead:
<span style= "FONT-SIZE:14PX;" >loadsetting (stmt, Settings.Secure.SET_INSTALL_LOCATION, 1);</span>

After this modification, the "Choose App Install Location" feature appears in Settings > apps, but no matter what you choose here, the Androidmanifest.xml file in the app is declared

<span style= "FONT-SIZE:14PX;" >android:installlocation = "Internalonly" </span>

, the APK will be installed on the phone, the benefit is to avoid the program run error, because the definition of android:installlocation = "Internalonly" APK is generally installed to the phone memory to function properly.

Android modifies the app's default installation location

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.