从服务器下载后以编程方式安装Android应用程序

时间:2013-01-08 10:08:54

标签: android android-intent

我开发了一个android应用程序,将.apk文件保存在服务器中。我开发了一个html文件,并在html中给出了.apk文件的链接。如果我点击链接,该文件正在下载。现在我的任务是以编程方式安装应用程序而不使用用户。我给了这样的代码......

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

任何人都可以在这方面帮助我,我对该怎么做感到沮丧。

1 个答案:

答案 0 :(得分:0)

  

现在我的任务是以编程方式安装应用程序而不使用用户

幸运的是,出于明显的安全原因,这对于普通的Android SDK应用程序是不可能的。

相关问题