pull/1395/head
gedoor 3 years ago
parent 3c8ae2b6da
commit 82b442f229
  1. 9
      app/src/main/java/io/legado/app/service/DownloadService.kt

@ -176,14 +176,11 @@ class DownloadService : BaseService() {
val intent = Intent() val intent = Intent()
intent.action = Intent.ACTION_VIEW intent.action = Intent.ACTION_VIEW
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { //7.0版本以上 //7.0版本以上
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
intent.setDataAndType(uri, IntentType.from(uri))
} else {
intent.setDataAndType(uri, IntentType.from(uri))
} }
intent.setDataAndType(uri, IntentType.from(uri))
try { try {
startActivity(intent) startActivity(intent)
} catch (e: Exception) { } catch (e: Exception) {

Loading…
Cancel
Save