add info about permissions on api level 30 for resolveActivity

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2021-05-03 14:06:31 +02:00
parent b97e670253
commit 5914f01524
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -281,12 +281,14 @@ public class MagicPreviewMessageViewHolder extends MessageHolders.IncomingImageM
}
}
private boolean canBeHandledByExternalApp(String mimetype, String fileName){
private boolean canBeHandledByExternalApp(String mimetype, String fileName) {
String path = context.getCacheDir().getAbsolutePath() + "/" + fileName;
File file = new File(path);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), mimetype);
// TODO resolveActivity might need more permissions starting with android 11 (api 30)
// https://developer.android.com/about/versions/11/privacy/package-visibility
return intent.resolveActivity(context.getPackageManager()) != null;
}