我开发了一个 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);
}