android:installlocation="auto",android:installLocation这个属性

从Level8(版本2.2)开始,可以将App安装到外部存储器(如SD卡)。通过在manifest属性中声明android:installLocation实现该功能,如果不声明,应用只会安装到内部存储器,并且不能转移到外部存储中。

在AndroidManifest.xml中加上属性android:installLocation,设置为preferExternal或auto

android:installLocation="preferExternal"

... >

【安装到外部存储中】

不会影响App性能;

.apk文件保存在外部存储中,而用户私有数据、数据库等保存在内部存储中;

由于存储App的容器由手机唯一加密,所以SD卡上的所有应用只能在本手机上解密使用。

【注意】

当手机开启USB大容量存储(USB mass storage)与电脑连接共享文件,或通过系统设置卸载SD卡后,所有外部存储中的应用都无法运行使用。

当App存在以下特性时,不要安装到外部存储中

Services

Your running Service will be killed and will not be restarted when external storage is remounted. You can, however, register for the ACTION_EXTERNAL_APPLICATIONS_AVAILABLE broadcast Intent, which will notify your application when applications installed on external storage have become available to the system again. At which time, you can restart your Service.

Alarm Services

Your alarms registered with AlarmManager will be cancelled. You must manually re-register any alarms when external storage is remounted.

Input Method Engines

Your IME will be replaced by the default IME. When external storage is remounted, the user can open system settings to enable your IME again.

Live Wallpapers

Your running Live Wallpaper will be replaced by the default Live Wallpaper. When external storage is remounted, the user can select your Live Wallpaper again.

App Widgets

Your App Widget will be removed from the home screen. When external storage is remounted, your App Widget will not be available for the user to select until the system resets the home application (usually not until a system reboot).

Account Managers

Your accounts created with AccountManager will disappear until external storage is remounted.

Sync Adapters

Your AbstractThreadedSyncAdapter and all its sync functionality will not work until external storage is remounted.

Device Administrators

Your DeviceAdminReceiver and all its admin capabilities will be disabled, which can have unforeseeable consequences for the device functionality, which may persist after external storage is remounted.

Broadcast Receivers listening for "boot completed"

The system delivers the ACTION_BOOT_COMPLETED broadcast before the external storage is mounted to the device. If your application is installed on the external storage, it can never receive this broadcast

文章来自 作者 http://xin3336019-sina-com.iteye.com/blog/1845766

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值