android应用程序的安装位置
来源:互联网 发布:机械手臂如何编程 编辑:程序博客网 时间:2024/04/29 09:45
本文编辑整理自:
http://blog.163.com/hero_213/blog/static/3989121420116212341948/
http://blog.163.com/hero_213/blog/static/39891214201162123639488/
Android应用程序的默认安装位置以及是否可移动取决于开发者在其AndroidManifest.xml中的设置
<manifest xmlns:android="http://schemas.android.com/apk/res/android"android:versionCode="1"android:installLocation="auto"android:versionName="1.0">
android:installLocation的值有三个 internalOnly ,auto,preferExternal,缺省值为internalOnly
internalOnly表示该应用程序只能安装到手机内部存储中。
auto表示由系统决定该应用程序安装到手机内部存储中还是SD卡中。 如果有SD卡且应用程序大于5M的话,安装到SD卡中,否则安排到手机内部存储中
preferExternal表示如果有SD卡就把该应用程序只能安装到SD卡中,否则安装到手机内部存储中。
android:installLocation为internalOnly时,用户在"Setting"->"Application"->"Manage applications"中不能把应用程序在SD卡与内存中相互移动
android:installLocation为auto或preferExternal时,用户在"Setting"->"Application"->"Manage applications"中可以把应用程序在SD卡与内存中相互移动
另外,adb shell 中可以使用 pm setInstallLocation 2 命令中强行更改安装位置。2代表的是强制安装在SD卡中,0代表自动,1代表强制装到手机内部存储中。
在代码中,对于高于Android 2.2的手机中,可以通过ApplicationInfo.FLAG_EXTERNAL_STORAGE 标记可以判断应用是否安装在Sdcard上,对于低于Android 2.2的手机可以通过ApplicationInfo的sourceDir属性为/sdcard/开头来确定APK安装的位置。
示例1
PackageManager pm=ctx.getPackageManager();ApplicationInfo appInfo=pm.getApplicationInfo(pkgName, 0);if ((appInfo.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0) {// App on sdcardSystem.out.println(pkgName+" install on sdcard");
结束!
原文地址: http://hubingforever.blog.163.com/blog/static/171040579201261105237486/
0 0
- android应用程序的安装位置
- android应用程序的安装位置
- Android应用程序的安装位置
- Android应用程序的安装位置
- Android应用程序的安装位置
- android应用程序的安装位置
- Android应用程序的安装位置
- Android应用程序安装位置
- Android应用程序的安装位置(一)
- Android应用程序的安装位置(二)
- Android应用程序的安装位置(一)
- Android应用程序的安装位置(二)
- android获取应用程序的安装位置
- android应用程序安装位置分析
- android应用程序安装位置分析
- android应用程序安装位置分析
- Android控制应用程序安装位置
- android如何确认一个应用程序的安装位置
- linux学习之--Linux下Nagios的安装与配置
- Codeforces Round #296 (Div. 2B. Error Correct System
- 怎么用php判断用户的访问是否是来自移动端
- JDBC(Statement)--Delete Record
- Dynamically set the height of ng-grid table
- android应用程序的安装位置
- cdh5下载地址
- 仿射变换在图像处理上的应用
- 纯CSS功能齐全的Tooltip工具提示插件
- [LeetCode刷题记录]Reverse Words in a String
- 进入显示logo界面以及导航界面,之后显示主界面
- nyoj 21 三个水杯 【BFS + 优先队列】
- fastjson使用介绍
- UVa:10790 - How Many Points of Intersection?