簡體   English   中英

Android如何安裝存儲在assets文件夾中的apk文件

[英]Android how to install apk file stored in assets folder

我可以使用以下代碼安裝存儲在SD卡上的apk文件:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File("/mnt/sdcard/downloads/Sample.apk")), "application/vnd.android.package-archive");
startActivity(intent);

如何安裝存儲在assets文件夾中的apk文件? 可能嗎?

使用以下代碼在SD卡上寫入文件: 如何將文件從'assets'文件夾復制到SD卡? 從該路徑安裝如下:

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

暫無
暫無

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

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