public bool BindService(string servicePackageName = null) { if (string.IsNullOrEmpty(servicePackageName)) { servicePackageName = CustomTabsHelper.GetPackageNameToUse(ParentActivity); if (servicePackageName == null) { return(false); } } connection = new CustomTabsServiceConnectionImpl { CustomTabsServiceConnectedHandler = (name, client) => { Client = client; var evt = CustomTabsServiceConnected; if (evt != null) { evt(name, client); } }, OnServiceDisconnectedHandler = (name) => { var evt = CustomTabsServiceDisconnected; if (evt != null) { evt(name); } } }; return(CustomTabsClient.BindCustomTabsService(ParentActivity, servicePackageName, connection)); }
public void LaunchUrl(string url, CustomTabsIntent customTabsIntent = null) { if (customTabsIntent == null) { customTabsIntent = new CustomTabsIntent.Builder() .Build(); } CustomTabsHelper.AddKeepAliveExtra(ParentActivity, customTabsIntent.Intent); customTabsIntent.LaunchUrl(ParentActivity, Android.Net.Uri.Parse(url)); }