Skip to content

Commit

Permalink
Adapt OS 13 when querying intent activities
Browse files Browse the repository at this point in the history
  • Loading branch information
rayworks committed Nov 13, 2023
1 parent e38cfe9 commit 4af453b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;

Expand Down Expand Up @@ -73,7 +74,13 @@ public static String getPackageNameToUse(Context context) {
}

// Get all apps that can handle VIEW intents.
List<ResolveInfo> resolvedActivityList = pm.queryIntentActivities(activityIntent, PackageManager.MATCH_ALL);
List<ResolveInfo> resolvedActivityList;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
resolvedActivityList = pm.queryIntentActivities(activityIntent, PackageManager.ResolveInfoFlags.of(
PackageManager.MATCH_ALL));
} else {
resolvedActivityList = pm.queryIntentActivities(activityIntent, PackageManager.MATCH_ALL);
}
List<String> packagesSupportingCustomTabs = new ArrayList<>();
for (ResolveInfo info : resolvedActivityList) {
Intent serviceIntent = new Intent();
Expand Down

0 comments on commit 4af453b

Please sign in to comment.