Open
Description
When a local app-owned file path is passed to the opener
plugin, it will tell us that there's no Activity that can open that uri. This is because FileProvider is not used, therefore a local uri is never converted to a ContentProvider uri, and therefore other apps cannot open our local files.
This code would work btw
import android.content.Intent
import androidx.core.content.FileProvider
import java.io.File
[...]
fun openPath(path: String) {
try {
val file = File(path);
val uri = FileProvider.getUriForFile(activity, activity.packageName + ".fileprovider", file);
val intent = Intent(Intent.ACTION_VIEW);
intent.setData(uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
activity.applicationContext?.startActivity(intent);
}catch (e: Exception){
}
}