我正在创建一个应用程序,用于安装从服务器下载的应用程序。我想安装这些应用程序的文件被下载了我使用的安装方法的代码之后是在这里:如何找出安装完成的时间
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();
}
我想有在安装后从SD卡中删除apk文件完成。此代码在安装启动后将其删除,导致安装失败。我相当新鲜的机器人,非常感谢一些帮助。我基本上是在继续这个过程之前,等待安装完成。
这不是一个答案,但更多的是提醒你一个可能性,并可能节省你的时间和精力,可能不被允许的东西。我不确定,也许其他人可以确认,但我认为从除Marketplace之外的任何地方下载应用程序都是不允许的。 – providence 2011-03-03 06:05:56
已经有从我设置的私人服务器上下载应用程序的代码,这个安装代码可以工作,但之后apk文件仍然存在,我希望它被删除。 – Bmoore 2011-03-03 22:43:04
安装后删除应用程序(\ *。apk)的可能的重复](http://stackoverflow.com/questions/15984546/delete-an-application-apk-after-installation) – 2013-10-09 09:36:52