Пример #1
0
        private bool TestIfGooglePlayServicesIsInstalled()
        {
            try
            {
                int queryResult = GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(this);
                if (queryResult == ConnectionResult.Success)
                {
                    return(true);
                }

                if (GoogleApiAvailability.Instance.IsUserResolvableError(queryResult))
                {
                    Dialog errorDialog = GoogleApiAvailability.Instance.GetErrorDialog(this, queryResult, InstallGooglePlayServicesId);
                    if (ErrorDialogFragment != null)
                    {
                        ErrorDialogFragment.Dismiss();
                    }
                    ErrorDialogFragment            = ErrorDialogFragment.NewInstance(errorDialog);
                    ErrorDialogFragment.Cancelable = false;
                    ErrorDialogFragment.Show(FragmentManager, "GooglePlayServicesDialog");
                }
            }
            catch (Exception e)
            {
                ExceptionHandler.Catch(e);
            }

            return(false);
        }
        protected bool ReadyToGo()
        {
            int status = GooglePlayServicesUtil.IsGooglePlayServicesAvailable(this);

            if (status == ConnectionResult.Success)
            {
                if (GetVersionFromPackageManager(this) >= 2)
                {
                    return(true);
                }
                else
                {
                    Toast.MakeText(this, Resource.String.no_maps, ToastLength.Long).Show();
                    Finish();
                }
            }
            else if (GooglePlayServicesUtil.IsUserRecoverableError(status))
            {
                ErrorDialogFragment e = new ErrorDialogFragment();

                e.NewInstance(status).Show(FragmentManager, TAG_ERROR_DIALOG_FRAGMENT);
            }
            else
            {
                Toast.MakeText(this, Resource.String.no_maps, ToastLength.Long).Show();
                Finish();
            }

            return(false);
        }
Пример #3
0
 public void ShowError(String errorMessage)
 {
     Android.Support.V4.App.DialogFragment fragment = ErrorDialogFragment.NewInstance(
         Resource.String.validationErrors, errorMessage);
     fragment.Show(mFragmentManager, "error");
 }