You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we use browser-switch in an special PayPalPlus flow.
Our App has an Intent filter to open in case an URL is for our web side.
We do this for the "Google Search Api" to link into our app or for generic mailing to our customer (Web and App customer)
In case the App is installed the app is opens, if not the browser is opens.
In case of an browser switch the app is opened because BrowserSwitchClient.start()
Didn't check for the possibility the App is also registered to the browserSwitchUrl.
class ChromeCustomTabsInternalClient {
....
void launchUrl(Context context, Uri url, boolean launchAsNewTask) {
CustomTabsIntent customTabsIntent = customTabsIntentBuilder.build();
if (launchAsNewTask) {
customTabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
customTabsIntent.launchUrl(context, url);
}
}
Here is no customTabsIntent.setPackage("browser.package we found");
An solution cut be to check if the App is registered for the browserSwitchUrl
And if so set the customTabsIntent.intent.setPackage("Browser we found");
before customTabsIntent.launchUrl(context, url);
private void checkAppPackageForActionView(Activity activity, Intent launchUrlInBrowser, String urlToLoad) {
String applicationPackageName = activity.getPackageName();
PackageManager pm = activity.getPackageManager();
Intent activityIntent = new Intent().setAction(Intent.ACTION_VIEW)
.setData(Uri.parse(urlToLoad));
List<ResolveInfo> resolvedActivityList = pm.queryIntentActivities(activityIntent, 0);
boolean packageView = false;
ArrayList<ResolveInfo> packagesSupportingCustomTabs = new ArrayList<>();
for (ResolveInfo info : resolvedActivityList) {
Intent serviceIntent = new Intent();
serviceIntent.setAction(ACTION_CUSTOM_TABS_CONNECTION);
serviceIntent.setPackage(info.activityInfo.packageName);
// check if application package also handle the url
if (applicationPackageName == null || info.activityInfo.packageName.equals(applicationPackageName)) {
packageView = true;
} else {
packagesSupportingCustomTabs.add(info);
}
}
if (packagesSupportingCustomTabs.size() > 0 && packageView) {
ResolveInfo info = packagesSupportingCustomTabs.get(0);
if (info != null && info.activityInfo != null ) {
launchUrlInBrowser.setPackage(info.activityInfo.packageName);
}
}
}
This check must be for installed ChromeCustomTab and for the activity.startActivity part in the BrowserSwitchClient
Regards
Stephan
The text was updated successfully, but these errors were encountered:
Hi @skauss Browser Switch doesn't offer explicit support for App Links at the moment. I'm not sure if there's a way to do this with any Android APIs. There are some tool to verify app links, but these are available only through the adb shell tool.
I also think there is no Android API to handle App Links.
But take a closer look into the my code snippet above checkAppPackageForActionView
In there I check if the App is responsible for the urlToLoad.
If so it add in to the Intent launchUrlInBrowser an browser package name which handle the request. launchUrlInBrowser.setPackage(info.activityInfo.packageName);
Now the app didn't start again !
I try to use the same variable names you use in the BrowserSwitch code.
Hi
we use
we use browser-switch in an special PayPalPlus flow.
Our App has an Intent filter to open in case an URL is for our web side.
We do this for the "Google Search Api" to link into our app or for generic mailing to our customer (Web and App customer)
In case the App is installed the app is opens, if not the browser is opens.
Now the problem :
The payment browser switch url got to our Web side (JavaScript Payment side) but also the app is registered to the url.
Example https://www.domain.com/payment/obj/angular-apps/standalone/paypal-plus-installments/?s......
AndroidManifest.xml
In case of an browser switch the app is opened because BrowserSwitchClient.start()
Didn't check for the possibility the App is also registered to the browserSwitchUrl.
customTabsInternalClient.launchUrl(activity, browserSwitchUrl, launchAsNewTask);
Here is no customTabsIntent.setPackage("browser.package we found");
An solution cut be to check if the App is registered for the browserSwitchUrl
And if so set the customTabsIntent.intent.setPackage("Browser we found");
before customTabsIntent.launchUrl(context, url);
This check must be for installed ChromeCustomTab and for the activity.startActivity part in the BrowserSwitchClient
Regards
Stephan
The text was updated successfully, but these errors were encountered: