I am using chrome custom tabs for getting oAuth connection request on the redirection from custom tabs I am redirected successfully in the app. The only problem remains is that the chrome custom tabs do not close on redirection stay in the stack.
Code for launching url in custom tabs is as follows.
customTabsIntent = new CustomTabsIntent.Builder(mCustomTabsSession)
.setToolbarColor(ContextCompat.getColor(getBaseContext(), R.color.colorPrimary))
.setStartAnimations(getBaseContext(),
R.anim.slide_in_right, R.anim.slide_out_left)
.setExitAnimations(getBaseContext(),
android.R.anim.slide_in_left, android.R.anim.slide_out_right)
.setShowTitle(true)
.build();
customTabsIntent.intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
customTabsIntent.intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
customTabsIntent.launchUrl(Settings_Activity.this, Uri.parse(fitbitUrlBuilder.toString()));
I tried using "singleTask" and "singleInstance" in manifest file but still the issue persist.
If I only use intent "FLAG_NO_HISTORY" it works. But I need to forcefully need to use "FLAG_ACTIVITY_NEW_TASK" since there is a certain edge case for e.g if the token of the specific site is deleted and we try reauthenticate the browser just collapses on android version 7.1 and need to manually start the app again.
Any help on this appreciated.