-
Notifications
You must be signed in to change notification settings - Fork 554
Description
Describe the bug
Hello, I am using aws mobile client on android and after I update from 2.26.0 to last version 2.30.0, on some devices
I am getting this exception "Browser with custom tabs support not found." from AuthClient.
When I did update I followed the documentation from here for the correct version "Version 2.27.0 and above":
https://docs.amplify.aws/sdk/auth/hosted-ui/q/platform/android/#automated-setup-with-cli
To Reproduce
A code sample or steps:
This issue can be reproduced in this way:
1. Disable the Chrome browser.
2. Try sign in and you will get this exception: new BrowserNotInstalledException("No browsers installed.").
3. Close app, then enable Chrome browser.
4. Open the app and try again the sign in. Now the browser check passed but checking for custom tab support failed:
new CustomTabsNotSupportedException("Browser with custom tabs support not found.")
The issue is on this class: com.amazonaws.mobileconnectors.cognitoauth.AuthClient on this function:
private void launchCustomTabs(final Uri uri, final Activity activity, final String browserPackage) {
try {
if(!isBrowserInstalled()) {
userHandler.onFailure(new BrowserNotInstalledException("No browsers installed."));
return;
}
if(!isCustomTabSupported()) {
userHandler.onFailure(new CustomTabsNotSupportedException("Browser with custom tabs support not found."));
return;
}
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(mCustomTabsSession);
mCustomTabsIntent = builder.build();
if(pool.getCustomTabExtras() != null)
mCustomTabsIntent.intent.putExtras(pool.getCustomTabExtras());
if(browserPackage != null) {
mCustomTabsIntent.intent.setPackage(browserPackage);
}
mCustomTabsIntent.intent.setData(uri);
if (activity != null) {
activity.startActivityForResult(
CustomTabsManagerActivity.createStartIntent(context, mCustomTabsIntent.intent),
CUSTOM_TABS_ACTIVITY_CODE
);
} else {
Intent startIntent = CustomTabsManagerActivity.createStartIntent(context, mCustomTabsIntent.intent);
startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY);
context.startActivity(startIntent);
}
} catch (final Exception e) {
userHandler.onFailure(e);
}
}
Which AWS service(s) are affected?
aws-android-sdk-cognitoauth
Environment Information (please complete the following information):
- AWS Android SDK Version: 2.30.0
- Device: Mi 10T Pro, Redmi K20, Redmi Note 7, Mi 9T Pro, Redmi Note 8T, Mi 10T Lite, HONOR 10i, realme 6, POCO X3 NFC, Galaxy S20, Redmi 9T, Redmi Note 8 Pro
- Android Version: Android 9, Android 10, Android 11
- Specific to simulators: No
Additional context
I tested a lot of devices and on some devices is working very well.
Also to be sure is version 2.30.0 the problem I downgrade the version to 2.26.0 and the issue was gone.