the default installation location for Android apps and whether they can be moved depends on the developer's settings in their androidmanifest.xml: <manifestxmlns:android="http://schemas.android.com/apk/res/android" Android:versioncode="1" android:installlocation="Auto" android:versionname="1.0"> Android:installlocation has a value of three internalonly ,auto,preferexternal, The default value is Internalonly internalonly indicates that the application can only be installed in the phone's internal storage. Auto indicates that the system determines whether the application is installed in the phone's internal storage or the SD card. If you have an SD card and the application is larger than 5M, install it into the SD card, otherwise it will be in the phone's internal storage .preferexternal indicates that the application can only be installed to the SD card if an SD card is available, otherwise it will be installed in the phone's internal storage. when Android:installlocation is internalonly, the user is " Setting", "Application", "Manage Applications "cannot move applications between SD card and memory when android:installlocation is auto or preferexternal, the user is " Setting", "Application", " Manage applications "allows applications to move between SD cards and memory In addition, the ADB shell can use the pm setinstalllocation 2 command to forcibly change the installation location. 2 represents the force installed on the SD card,0 for Automatic, and1 for the mandatory loading into the phone's internal storage. In the code, for phones higher than Android 2.2, the applicationinfo.flag_external_storage tag can be used to determine if an app is installed on SDcard. For phones that are below Android 2.2, you can determine the location of the APK installation by ApplicationInfo the SourceDir property to the beginning of the/sdcard/. Example 1 packagemanager pm=ctx. Getpackagemanager(); applicationinfo appInfo=pm. Getapplicationinfo(pkgname,0); if(appInfo. Flags &applicationinfo. Flag_external_storage)!=0){ //App on SDcard System.out.println (pkgname+ "Install on SDcard");
Where to install Android apps