下载的APK无法打开

时间:2020-08-09 18:29:58

标签: android

我正在使用此代码通过更新按钮下载apk,并希望在下载完成后打开应用。

这是我当前的代码:

DownloadManager downloadmanager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
Uri uri = Uri.parse("https://www.globalgreyebooks.com/content/books/ebooks/game-of-life.apk");

DownloadManager.Request request = new DownloadManager.Request(uri);
//request.setTitle("My File");
//request.setDescription("Downloading");

request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,"game-of.apk");
downloadmanager.enqueue(request);

使用此代码,该应用仍无法打开。它仅在源之后打开。我将如何去做?

0 个答案:

没有答案