fix: try to open with Chrome if default browser app does not support custom tabs

This commit is contained in:
Eiichiro Adachi 2022-06-27 12:44:36 +09:00
parent ee1b0d7ff7
commit 65f0459579
1 changed files with 6 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import android.content.IntentFilter;
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;
@ -59,7 +60,11 @@ public class CustomTabsHelper {
}
// Get all apps that can handle VIEW intents.
List<ResolveInfo> resolvedActivityList = pm.queryIntentActivities(activityIntent, 0);
int flags = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
flags |= PackageManager.MATCH_ALL;
}
List<ResolveInfo> resolvedActivityList = pm.queryIntentActivities(activityIntent, flags);
List<String> packagesSupportingCustomTabs = new ArrayList<>();
for (ResolveInfo info : resolvedActivityList) {
Intent serviceIntent = new Intent();