Skip to content

Support custom tabs in more browsers #6705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions firebase-appdistribution/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<queries>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>

<application>
<service
android:name="com.google.firebase.components.ComponentDiscoveryService"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import androidx.browser.customtabs.CustomTabsClient;
import androidx.browser.customtabs.CustomTabsIntent;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.Task;
Expand All @@ -36,7 +36,7 @@
import com.google.firebase.appdistribution.FirebaseAppDistributionException.Status;
import com.google.firebase.inject.Provider;
import com.google.firebase.installations.FirebaseInstallationsApi;
import java.util.List;
import java.util.Collections;
import java.util.concurrent.Executor;
import javax.inject.Inject;
import javax.inject.Singleton;
Expand Down Expand Up @@ -212,10 +212,7 @@ private void openSignInFlowInBrowser(String fid, Activity activity) {
}

private boolean supportsCustomTabs(Context context) {
Intent customTabIntent = new Intent("android.support.customtabs.action.CustomTabsService");
customTabIntent.setPackage("com.android.chrome");
List<ResolveInfo> resolveInfos =
context.getPackageManager().queryIntentServices(customTabIntent, 0);
return resolveInfos != null && !resolveInfos.isEmpty();
String packageName = CustomTabsClient.getPackageName(context, Collections.emptyList());
return packageName != null;
}
}
Loading