您的位置:首页 > 移动开发

Android App--Android apk默认安装位置设置

2014-03-20 13:59 381 查看
在Android工程中,设置apk的默认安装位置

在AndroidManifest.xml文件Manifest标签中添加android:installLocation属性

android:installLocation

这个属性设置的是默认安装位置, 共有三个有效值,auto、internalOnly、preferExternal

对应表

auto 表示自动,由系统决定安装位置

internalOnly 安装在手机内存

preferExternal 安装在外部存储中
ConstantValueDescription
auto0Let the system decide install location
internalOnly1Explicitly request to be installed on internal phone storage only
preferExternal2Perfer to be installed on SD card, There is no guarantee that the system will honor this request. The application might end up being installed on internal storage if external media is unavailable or too full
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ray"
android:installLocation="auto"
android:versionCode="1"
android:versionName="1.0">


需要注意的问题(如果遇到其他问题,后期进行补充)

需要开启启动的程序,一定要安装到手机内存中,这里就关系到广播消息的先后顺序

开机启动的广播消息BOOT_COMPLETE早于 SD的启动,如果将程序安装到SD卡,无法接收到开机广播。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: