简体   繁体   English

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

[英]Android,Coding an app and want to know how to indicate the to be install in SD card

I am building an heavy app (20mb) so i would like to know how to make as default installation to install in SD card i try few tutorial but not success the version of my android code is 2.2.我正在构建一个重型应用程序(20mb)所以我想知道如何将默认安装设置为安装在 SD 卡中我尝试了一些教程但没有成功我的 android 代码的版本是 2.2。

I add in the manifest the line:我在清单中添加以下行:

 android:installLocation="preferExternal"

but nothing happen但什么也没发生

 <?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" />

I will appreciate Help!!!我将感谢帮助!

You should read carefully this description on Android Developers, and make sure, that您应该仔细阅读 Android Developers 上的说明,并确保

  • your SD card is not used as an external storage by your computer (the connection type should be charhe only ),您的 SD 卡没有被您的计算机用作外部存储(连接类型应该是charhe only ),
  • your SD card is not full.您的 SD 卡未满。

In the manifest file for the application you can set the android:installLocation value to 'preferExternal' - see the documentation here .在应用程序的清单文件中,您可以将 android:installLocation 值设置为“preferExternal” - 请参阅此处的文档。

There's no guarantee that the preference will be honored, but the SD card would be the default if you set preferExternal.无法保证首选项会得到尊重,但如果您设置了 preferExternal,SD 卡将是默认设置。

IF you have included android:installLocation="preferExternal" then after installing application go to settings->application->manage application from there you can move application to SD card.如果您已包含 android:installLocation="preferExternal" 则在将应用程序 go 安装到设置->应用程序->管理应用程序后,您可以将应用程序移动到 SD 卡。

Else Try this .否则试试这个 It may help you.它可能会帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM