小编Bmo*_*ore的帖子

如何找出安装完成的时间

我正在创建一个安装从服务器下载的应用程序的应用程序.我想安装这些应用程序下载文件后,我用来安装的方法的代码在这里:

 public void Install(String name)
{
    //prompts user to accept any installation of the apk with provided name
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(new File
    (Environment.getExternalStorageDirectory() + "/ContentManager/" + name)), "application/vnd.android.package-archive");
    startActivity(intent);
    //this code should execute after the install finishes
    File file = new File(Environment.getExternalStorageDirectory() + "/ContentManager/"+name);
    file.delete();

}
Run Code Online (Sandbox Code Playgroud)

我想在安装完成后从sd卡中删除apk文件.安装启动后,此代码将删除它,导致安装失败.我非常喜欢android,非常感谢一些帮助.我基本上试图等待安装完成后再继续这个过程.

android

3
推荐指数
1
解决办法
7115
查看次数

标签 统计

android ×1