指定安装应用程序移至SD卡(App2SD)

在2.2发布之后,除了增加Flash Player的支持外,最令人瞩目的莫过于App to Sdcard的支持了。至此之前,android应用程序仅能安装于手机内存,而在“有限”的资源下,至多能安装50-100套程序。    

1.Intent i = new Intent("android.intent.action.MANAGE_PACKAGE_STORAGE");

  startActivity(i);

2.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.spinner"
    android:versionCode="1"
    android:installLocation="preferExternal"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.spinner.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

a.android:installLocation="preferExternal"   //如API小于8,那系统无法识别

b.android:installLocation="auto"               //只说下这个把,其他2个就不说了。默认安装在内存里,如果发现手机内存偏低,且内存卡也存在,则由系统决定安装的位置。

c.android:installLocation="internalOnly"

原文地址:https://www.cnblogs.com/royi123/p/3297559.html