在Android工程中,設置apk的默認安裝位置
在AndroidManifest.xml文件Manifest標籤中添加android:installLocation屬性
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">