【Android】Android apk默認安裝位置設置


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

需要注意的問題(如果遇到其他問題,后期進行補充)

需要開啟啟動的程序,一定要安裝到手機內存中,這里就關系到廣播消息的先后順序

開機啟動的廣播消息BOOT_COMPLETE早於 SD的啟動,如果將程序安裝到SD卡,無法接收到開機廣播。

                                                                                                                                                                                                             

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

本文出自 Ray-Ray的博客

文章地址 http://www.cnblogs.com/rayray/p/3185811.html 

感謝大家的推薦和收藏

你的支持! 我們的動力!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM