private void BindCustomTabsService()
        {
            if (custom_tabs_client != null)
            {
                return;
            }
            if (TextUtils.IsEmpty(mPackageNameToBind))
            {
                mPackageNameToBind = PackageManagerHelper.GetPackageNameToUseDefaultUri(this);
                if (mPackageNameToBind == null)
                {
                    return;
                }
            }

            custom_tabs_service_connection = new ServiceConnection(this);
            bool ok = CustomTabsClient.BindCustomTabsService(this, mPackageNameToBind, custom_tabs_service_connection);

            if (ok)
            {
                mConnectButton.Enabled = false;
            }
            else
            {
                custom_tabs_service_connection = null;
            }
        }
        /// <summary>
        /// Binds the Activity to the Custom Tabs Service. </summary>
        /// <param name="activity"> the activity to be binded to the service. </param>
        public virtual void BindCustomTabsService(Activity activity)
        {
            if (custom_tabs_client != null)
            {
                return;
            }
            ;

            List <string> packages    = PackageManagerHelper.GetPackageNameToUse(activity, this.UriTest);
            string        packageName = "";

            if (packageName == null)
            {
                Toast.MakeText
                (
                    activity,
                    "No packages supporting CustomTabs found!",
                    ToastLength.Short
                ).Show();

                return;
            }

            custom_tabs_service_connection = new ServiceConnection(this);
            CustomTabsClient.BindCustomTabsService(activity, packageName, custom_tabs_service_connection);

            return;
        }
Ejemplo n.º 3
0
        void BindCustomTabsService()
        {
            if (mClient != null)
            {
                return;
            }
            if (TextUtils.IsEmpty(mPackageNameToBind))
            {
                mPackageNameToBind = CustomTabsHelper.GetPackageNameToUse(this);
                if (mPackageNameToBind == null)
                {
                    return;
                }
            }
            mConnection = new ServiceConnection(this);
            bool ok = CustomTabsClient.BindCustomTabsService(this, mPackageNameToBind, mConnection);

            if (ok)
            {
                mConnectButton.Enabled = false;
            }
            else
            {
                mConnection = null;
            }
        }
 public void UnbindCustomTabsService(Activity activity)
 {
     if (mConnection == null)
     {
         return;
     }
     activity.UnbindService(mConnection);
     mClient            = null;
     mCustomTabsSession = null;
     mConnection        = null;
 }
        /// <summary>
        /// Unbinds the Activity from the Custom Tabs Service. </summary>
        /// <param name="activity"> the activity that is connected to the service. </param>
        public virtual void UnbindCustomTabsService(Activity activity)
        {
            if (custom_tabs_service_connection == null)
            {
                return;
            }
            activity.UnbindService(custom_tabs_service_connection);
            custom_tabs_client             = null;
            custom_tabs_session            = null;
            custom_tabs_service_connection = null;

            return;
        }
        public void BindCustomTabsService(Activity activity)
        {
            if (mClient != null)
            {
                return;
            }

            var packageName = CustomTabsHelper.GetPackageNameToUse(activity);

            if (packageName == null)
            {
                return;
            }

            mConnection = new ServiceConnection(this);
            CustomTabsClient.BindCustomTabsService(activity, packageName, mConnection);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Binds the Activity to the Custom Tabs Service. </summary>
        /// <param name="activity"> the activity to be binded to the service. </param>
        public virtual void bindCustomTabsService(Activity activity)
        {
            if (mClient != null)
            {
                return;
            }

            string packageName = Org.Chromium.CustomTabsClient.Shared.CustomTabsHelper.GetPackageNameToUse(activity);

            if (packageName == null)
            {
                return;
            }

            mConnection = new ServiceConnection(this);
            CustomTabsClient.BindCustomTabsService(activity, packageName, mConnection);
        }
        /// <summary>
        /// Binds the Activity to the Custom Tabs Service. </summary>
        /// <param name="activity"> the activity to be binded to the service. </param>
        public virtual void BindCustomTabsService(Activity activity)
        {
            if (custom_tabs_client != null)
            {
                return;
            }

            string packageName = PackageManagerHelper.GetPackageNameToUse(activity, this.UriTest);

            if (packageName == null)
            {
                return;
            }

            custom_tabs_service_connection = new ServiceConnection(this);
            CustomTabsClient.BindCustomTabsService(activity, packageName, custom_tabs_service_connection);

            return;
        }