<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