【问题标题】:Android how to install apk file stored in assets folderAndroid如何安装存储在资产文件夹中的apk文件
【发布时间】:2015-04-25 23:51:27
【问题描述】:

我可以使用以下代码安装存储在 sdcard 上的 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 文件?可能吗?

【问题讨论】:

    标签: android android-install-apk


    【解决方案1】:

    使用以下代码在 sdcard 上写入文件: How to copy files from 'assets' folder to sdcard? 并从该路径安装:

    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);  
    

    【讨论】:

    • 手机没有sd卡只有内存是什么情况?
    猜你喜欢
    • 1970-01-01
    • 2015-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多