File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
app/src/main/kotlin/com/simplemobiletools/filemanager/extensions Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,12 @@ package com.simplemobiletools.filemanager.extensions
22
33import android.app.Activity
44import android.content.Intent
5+ import android.net.Uri
6+ import android.support.v4.content.FileProvider
57import com.simplemobiletools.commons.R
68import com.simplemobiletools.commons.extensions.*
79import com.simplemobiletools.filemanager.BuildConfig
10+ import java.io.File
811import java.util.*
912
1013fun Activity.sharePaths (paths : ArrayList <String >) {
@@ -13,7 +16,12 @@ fun Activity.sharePaths(paths: ArrayList<String>) {
1316
1417fun Activity.tryOpenPathIntent (path : String , forceChooser : Boolean ) {
1518 if (! forceChooser && path.endsWith(" .apk" , true )) {
16- val uri = getFinalUriFromPath(path, BuildConfig .APPLICATION_ID ) ? : return
19+ val uri = if (isNougatPlus()) {
20+ FileProvider .getUriForFile(this , " ${BuildConfig .APPLICATION_ID } .provider" , File (path))
21+ } else {
22+ Uri .fromFile(File (path))
23+ }
24+
1725 Intent ().apply {
1826 action = Intent .ACTION_VIEW
1927 setDataAndType(uri, getMimeTypeFromUri(uri))
You can’t perform that action at this time.
0 commit comments