簡體   English   中英

在姜餅上安裝本地.apk文件的意圖

[英]Install intent for local .apk file on gingerbread

當我從Android 2.1上的另一個應用安裝新的APK時,我只是使用了:

Intent intent2 = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory()+"/Download/" + "app.apk")), "application/vnd.android.package-archive");
startActivity(intent2);

它打開了新的安裝對話框,我可以使用它。

現在,我在Gingerbread 2.3.3上嘗試相同的代碼,並且當我啟動此安裝意圖時,它向我顯示了一個選擇“使用應用程序選擇動作”。 有以下選擇:Google Talk,視頻,videotalk,DRM,Market。

發生了什么? Gingerbread中的安裝意圖是否發生了變化? 如何在Android Gingerbread上進行新安裝? 謝謝

API參考指出 ,在startActivity(Intent)方法中未應用任何更改。 ACTION_VIEW啟動默認活動來處理一條數據或要求選擇一個默認活動(如我所見)。 如果您要獲取要啟動的應用程序列表,則該類型的數據沒有默認操作。 另外,請檢查是否在設備上啟用了非市場應用程序的安裝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM