In my app, I need to do login through a web page. On successful log-in it is returning in the header of the response as "my-app:/auth?code=xxxxxx&status=xxxxx". I configured a custom schema in my APP.
Code to open Chrome custom tab:
StringBuilder url = new StringBuilder(<url>);
url=url.append("&response_type=code");
url=url.append("&redirect_uri=");
url=url.append("my-app:/auth");
CustomTabsSession session = getSession();
CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
intentBuilder.setToolbarColor(Color.parseColor("#ffffff"));
intentBuilder.setShowTitle(true);
intentBuilder.setNavigationBarColor(Color.parseColor("#ffffff"));
intentBuilder.setSecondaryToolbarColor(Color.parseColor("#ffffff"));
intentBuilder.setSession(session);
CustomTabsIntent customTabsIntent=intentBuilder.build();
CustomTabsHelper.addKeepAliveExtra(this, customTabsIntent.intent);
CustomTabActivityHelper.openCustomTab(this, customTabsIntent, Uri.parse(url.toString()),
(activity, uri1) -> {
showProgressDialog();
Bundle bundle = new Bundle();
bundle.putInt("screen_type", type);
LoginWebViewFragment loginWebViewFragment = LoginWebViewFragment.getInstance();
loginWebViewFragment.setArguments(bundle);
startNewFragment(loginWebViewFragment, "LoginWebViewFragment");
});
Schema configured in Manifest file:
<activity
android:name="<myActivity>"
android:screenOrientation="portrait"
android:theme="@style/transparent_status_bar" >
<intent-filter>
<data android:scheme="my-app" />
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
After a successful login, the App is not opening. Is this possible to redirect from the Chrome custom tab to App?