mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 23:40:33 +05:30
fix updater
This commit is contained in:
parent
f9f634de1a
commit
8e4b03a13b
@ -58,12 +58,15 @@ class UpdateService : Service() {
|
|||||||
val id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1)
|
val id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1)
|
||||||
if (downloadId == id) {
|
if (downloadId == id) {
|
||||||
// install the apk after download finished
|
// install the apk after download finished
|
||||||
val installIntent = Intent(Intent.ACTION_VIEW)
|
val installIntent = Intent(Intent.ACTION_VIEW).apply {
|
||||||
installIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
installIntent.setDataAndType(
|
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||||
Uri.fromFile(file),
|
setDataAndType(
|
||||||
downloadManager.getMimeTypeForDownloadedFile(downloadId)
|
Uri.fromFile(file),
|
||||||
)
|
downloadManager.getMimeTypeForDownloadedFile(downloadId)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
startActivity(installIntent)
|
startActivity(installIntent)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user