关于被安装到sdcard,无法接受到系统启动事件的问题, 修改安装路径

来源:互联网 发布:淘宝淘抢购收费标准 编辑:程序博客网 时间:2024/04/29 08:01

目前免费WiFi的apk,没有设置建议安装到手机内存的属性,会导致部分应用市场,手机ROM将应用安装到sdcard。

开机启动的广播消息BOOT_COMPLETE早于 SD的启动,如果将程序安装到SD卡,无法接收到开机广播。

 

建议增加安装到手机内存的属性,否则无法正常接收BOOT_COMPLETE早事件。

 

 

在Android工程中,设置apk的默认安装位置 

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

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

对应表

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

internalOnly 安装在手机内存

preferExternal 安装在外部存储中

Constant

Value

Description

auto

0

Let the system decide install location

internalOnly

1

Explicitly request to be installed on internal phone storage only

preferExternal

2

Perfer 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">

0 0
原创粉丝点击