将应用程序移动到SD卡

38

在某些最小SDK版本为3(Android 1.5)的应用中,我可以将应用从我的Desire HD(Android 2.2)移动到SD卡中。如何使其编程实现在需要Android 1.5及更高版本时将应用移动到SD卡上。


不要忘记通过点击响应旁边的复选标记将某人的响应标记为已回答。 - Atticus
3个回答

79

在您的manifest.xml文件的<application>标签中添加android:installLocation="auto"属性。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.myapp" android:installLocation="auto"
android:versionCode="2" android:versionName="1.2">

这将使您的应用程序启用“移动到SD卡”按钮。


30

6
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="string"
          android:sharedUserId="string"
          android:sharedUserLabel="string resource" 
          android:versionCode="integer"
          android:versionName="string"
          android:installLocation=["auto" | "internalOnly" | "preferExternal"] >

</manifest>

参考链接:点击此处


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接