Android,编写一个应用程序,想知道如何指示要安装在SD卡



我正在构建一个沉重的应用程序(20mb),所以我想知道如何使默认安装安装在SD卡我尝试几个教程,但不成功的版本我的android代码是2.2。

我在舱单中添加这一行:

 android:installLocation="preferExternal"

但什么也没发生

 <?xml version="1.0" encoding="utf-8"?>

<application android:icon="@drawable/icon" android:label="@string/app_name">
<supports-screens
    android:smallScreens="true"
    android:normalScreens="true"
    android:largeScreens="true"
    android:resizeable="true"
    android:anyDensity="true"/>
    <activity android:name=".Toto"
              android:label="@string/app_name" android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

我将感激帮助!!

你应该仔细阅读Android开发人员的描述,并确保

  • 您的SD卡没有被用作计算机的外部存储器(连接类型应为charhe only),
  • 您的SD卡未满。

在应用程序的manifest文件中,你可以将android:installLocation的值设置为'preferExternal' -参见这里的文档。

不能保证这个首选项会被尊重,但是如果你设置了preferExternal, SD卡将是默认的。

如果你已经包含了android:installLocation="preferExternal",那么在安装应用程序后进入设置->应用程序->管理应用程序,你可以从那里移动应用程序到SD卡。

Else试试这个。

最新更新