private void OnConnectionFailed(ConnectionResult result)
 {
     if (result.HasResolution)
     {
         result.StartResolutionForResult(_activity, ResolutionRequestCode);
     }
 }
예제 #2
0
        public void OnConnectionFailed (ConnectionResult result)
        {
            Log.Debug (TAG, "onConnectionFailed:" + result);

            if (!mIsResolving && mShouldResolve)
            {
                if (result.HasResolution)
                {
                    try
                    {
                        result.StartResolutionForResult (Activity, RC_SIGN_IN);
                        mIsResolving = true;
                    }
                    catch (IntentSender.SendIntentException e)
                    {
                        Log.Error (TAG, "Could not resolve ConnectionResult.", e);
                        mIsResolving = false;
                        mGoogleApiClient.Connect ();
                    }
                }
                else {
                    ShowErrorDialog (result);
                }
            }
            else {
                UpdateUI (false);
            }
        }
예제 #3
0
        public void OnConnectionFailed(ConnectionResult result)
        {
            Log.Debug(TAG, "onConnectionFailed:" + result);

            if (!mIsResolving && mShouldResolve)
            {
                if (result.HasResolution)
                {
                    try {
                        result.StartResolutionForResult(this, RC_SIGN_IN);
                        mIsResolving = true;
                    } catch (IntentSender.SendIntentException e) {
                        Log.Error(TAG, "Could not resolve ConnectionResult.", e);
                        mIsResolving = false;
                        mGoogleApiClient.Connect();
                    }
                }
                else
                {
                    ShowErrorDialog(result);
                }
            }
            else
            {
                UpdateUI(false);
            }
        }
        public void OnConnectionFailed(ConnectionResult result)
        {
            if (resolvingError)
            {
                return; // Already attempting to resolve an error.
            }
            if (!(context is Activity))
            {
                SimpleLocationLogger.Log("Connection failed. Error: " + result.ErrorCode);
                return;
            }

            if (result.HasResolution)
            {
                try {
                    resolvingError = true;
                    result.StartResolutionForResult(context as Activity, requestResolveError);
                } catch (Exception e) {
                    SimpleLocationLogger.Log("Connection failed. Error: " + e.Message);
                    googleApiClient.Connect(); // There was an error with the resolution intent. Try again.
                }
            }
            else
            {
                var dialog = GoogleApiAvailability.Instance.GetErrorDialog(context as Activity, result.ErrorCode, requestResolveError);
                dialog.DismissEvent += (sender, e) => resolvingError = false;
                dialog.Show();

                resolvingError = true;
            }
        }
 bool resolveConnectionFailure(Activity activity, Android.Gms.Common.Apis.GoogleApiClient client, ConnectionResult result, int requestCode, string fallbackErrorMessage)
 {
     if (result.HasResolution)
     {
         try {
             result.StartResolutionForResult(activity, requestCode);
             return(true);
         } catch (IntentSender.SendIntentException e) {
             // The intent was canceled before it was sent.  Return to the default
             // state and attempt to connect to get an updated ConnectionResult.
             client.Connect();
             return(false);
         }
     }
     else
     {
         // not resolvable... so show an error message
         int errorCode = result.ErrorCode;
         var dialog    = GooglePlayServicesUtil.GetErrorDialog(errorCode, activity, requestCode);
         if (dialog != null)
         {
             dialog.Show();
         }
         else
         {
             // no built-in dialog: show the fallback error message
             //ShowAlert (activity, fallbackErrorMessage);
             (new AlertDialog.Builder(activity)).SetMessage(fallbackErrorMessage)
             .SetNeutralButton(Android.Resource.String.Ok, delegate { }).Create().Show();
         }
         return(false);
     }
 }
예제 #6
0
 public void OnConnectionFailed(ConnectionResult result)
 {
     if (!mIsResolving & mShouldResolve)
     {
         if (result.HasResolution)
         {
             try
             {
                 result.StartResolutionForResult(this, RC_SIGN_IN);
                 mIsResolving = true;
             }
             catch (IntentSender.SendIntentException e)
             {
                 mIsResolving = false;
                 mGoogleApiClient.Connect();
             }
         }
         else
         {
             ShowErrorDialog(result);
         }
     }
     else
     {
         UpdateData(false);
     }
 }
예제 #7
0
        void resolveConnection()
        {
            if (mIsResolving)
            {
                return;
            }

            try {
                if (mConnectionResult != null && mConnectionResult.HasResolution)
                {
                    mConnectionResult.StartResolutionForResult(Activity, REQUEST_CODE_RESOLVE_ERR);
                    mIsResolving = true;
                }
                else
                {
                    dismissProgressDialog();
                }
            } catch (Android.Content.IntentSender.SendIntentException) {
                mConnectionResult = null;
                mIsResolving      = false;

                dismissProgressDialog();
                mGoogleApiClient.Connect();
            }
        }
예제 #8
0
 void ResolveConnectionResult()
 {
     // Try to resolve the problem
     //debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult);
     if (connectionResult.HasResolution)
     {
         // This problem can be fixed. So let's try to fix it.
         //debugLog("result has resolution. Starting it.");
         try
         {
             // launch appropriate UI flow (which might, for example, be the
             // sign-in flow)
             expectingActivityResult = true;
             connectionResult.StartResolutionForResult(activity, RC_RESOLVE);
         }
         catch (Exception e)
         {
             // Try connecting again
             //debugLog("SendIntentException.");
             ConnectCurrentClient();
         }
     }
     else
     {
         // It's not a problem what we can solve, so give up and show an
         // error.
         //debugLog("resolveConnectionResult: result has no resolution. Giving up.");
         GiveUp();
     }
 }
예제 #9
0
 public void OnConnectionFailed(ConnectionResult result)
 {
     if (Log.IsLoggable(Constants.TAG, LogPriority.Debug))
     {
         Log.Debug(Constants.TAG, "Disconnected from Google Api Service");
     }
     if (WearableClass.NodeApi != null)
     {
         WearableClass.NodeApi.RemoveListener(mGoogleApiClient, this);
     }
     if (mResolvingError)
     {
         // Already attempting to resolve the error
         return;
     }
     else if (result.HasResolution)
     {
         try {
             mResolvingError = true;
             result.StartResolutionForResult(this, REQUEST_RESOLVE_ERROR);
         } catch {
             // There was an error with the resolution intent. Try again
             mGoogleApiClient.Connect();
         }
     }
     else
     {
         mResolvingError = false;
     }
 }
예제 #10
0
 public void OnConnectionFailed(ConnectionResult result)
 {
     Log.Debug(TAG, "OnConnectionFailed");
     if (_resolvingError)
     {
         return;
     }
     if (result.HasResolution)
     {
         try
         {
             _resolvingError = true;
             result.StartResolutionForResult(this, REQUEST_RESOLVE_ERROR);
         }
         catch (IntentSender.SendIntentException e)
         {
             Log.Debug(TAG, e.Message);
             client.Connect();
         }
     }
     else
     {
         ShowErrorDialog(result.ErrorCode);
     }
 }
예제 #11
0
 public void RequestGoogleFitnessAuthentication(ConnectionResult result)
 {
     if (!authInProgress)
     {
         authInProgress = true;
         result.StartResolutionForResult(this, REQUEST_GOOGLE_FITNESS_AUTH);
     }
 }
예제 #12
0
 private void resolveGoogleLogin(ConnectionResult result)
 {
     if (result.HasResolution)
     {
         try {
             result.StartResolutionForResult(this, 9000);
         }
         catch (Android.Content.IntentSender.SendIntentException) {
             plusClient.Connect();
         }
     }
 }
예제 #13
0
        public void OnConnectionFailed(ConnectionResult result)
        {
            if (currentlyResolvingConnection)
            {
                return;
            }

            if (result.HasResolution)
            {
                currentlyResolvingConnection = true;
                result.StartResolutionForResult(activity, REQUEST_CODE_RESOLVE);
            }
        }
 public void OnConnectionFailed(ConnectionResult result)
 {
     if (result.HasResolution)
     {
         try {
             result.StartResolutionForResult(this, 101);
         } catch (IntentSender.SendIntentException ex) {
             // Unable to resolve, message user appropriately
         }
     }
     else
     {
         GooglePlayServicesUtil.GetErrorDialog(result.ErrorCode, this, 0).Show();
     }
 }
예제 #15
0
 /// <summary>
 /// Checks to see if we have a resolution
 /// </summary>
 /// <param name="result">Result.</param>
 private void ResolveLogin(ConnectionResult result)
 {
     if (result.HasResolution)
     {
         try {
             result.StartResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR);
         } catch (Android.Content.IntentSender.SendIntentException e) {
             plusClient.Connect();
         }
     }
     else if (progressDialog != null && progressDialog.IsShowing)
     {
         progressDialog.Dismiss();
     }
 }
예제 #16
0
        //
        // END IGoogleApiClientOnConnectionFailedListener

        private void ResolveConnectionResult(ConnectionResult result)
        {
            // Does this failure reason have a solution?
            if (result.HasResolution)
            {
                try
                {
                    // Try to resolve the problem automatically.
                    result.StartResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR);
                }
                catch (Android.Content.IntentSender.SendIntentException /*e*/)
                {
                    mGoogleApiClient.Connect();
                }
            }
        }
예제 #17
0
 private void startResolution()
 {
     try
     {
         mLastConnectionResult.StartResolutionForResult(GetActivity(), mRequestCode);
         hideProgressDialog();
     }
     catch (IntentSender.SendIntentException e)
     {
         // The intent we had is not valid right now, perhaps the remote process died.
         // Try to reconnect to get a new resolution intent.
         mLastConnectionResult = null;
         showProgressDialog();
         connectPlusClient();
     }
 }
예제 #18
0
 //если ошибка подключения
 private void onConnectionFailed(ConnectionResult result)
 {
     if (!result.HasResolution)
     {
         GoogleApiAvailability.Instance.GetErrorDialog(this, result.ErrorCode, 0).Show();
         return;
     }
     try
     {
         result.StartResolutionForResult(this, REQUEST_CODE_RESOLUTION);
     }
     catch (IntentSender.SendIntentException e)
     {
         CreateAlertDialog("", errorMessage + e.Message);
     }
 }
예제 #19
0
        public void OnConnectionFailed(ConnectionResult result)
        {
            mMomentListView.Adapter = null;
            if (mResolvingError)
            {
                return;
            }

            try {
                result.StartResolutionForResult(this, REQUEST_CODE_SIGN_IN);
                mResolvingError = true;
            } catch (IntentSender.SendIntentException e) {
                // Try connecting again.
                mGoogleApiClient.Connect();
            }
        }
예제 #20
0
        public void OnConnectionFailed(ConnectionResult result)
        {
            if (mResolvingError)
            {
                return;
            }

            mPersonListView.Adapter = null;
            try {
                result.StartResolutionForResult(this, REQUEST_CODE_SIGN_IN);
                mResolvingError = true;
            } catch (Android.Content.IntentSender.SendIntentException) {
                // Get another pending intent to run.
                mGoogleApiClient.Connect();
            }
        }
 void resolveConnection()
 {
     try {
         if (mConnectionResult != null && mConnectionResult.HasResolution)
         {
             mConnectionResult.StartResolutionForResult(Activity, REQUEST_CODE_RESOLVE_ERR);
         }
         else
         {
             mGoogleApiClient.Connect();
         }
     }  catch (Android.Content.IntentSender.SendIntentException e) {
         mConnectionResult = null;
         mGoogleApiClient.Connect();
     }
 }
예제 #22
0
 void resolveSignInError()
 {
     if (mConnectionResult.HasResolution)
     {
         try {
             mIntentInProgress = true;
             logVerbose("Start the resolution intent, flipping the intent-in-progress bit.");
             mConnectionResult.StartResolutionForResult(this, REQUEST_CODE_SIGN_IN);
         } catch (IntentSender.SendIntentException e) {
             // The intent was canceled before it was sent.  Return to the default state and
             // attempt to connect to get an updated ConnectionResult.
             mIntentInProgress = false;
             mGoogleApiClient.Connect();
             Console.WriteLine("Error sending the resolution Intent, connect() again.");
         }
     }
 }
        public void OnConnectionFailed(ConnectionResult result)
        {
            if (resolvingError)
                return; // Already attempting to resolve an error.

            if (result.HasResolution)
                try {
                    resolvingError = true;
                    result.StartResolutionForResult(context, 1001);
                } catch (Exception e) {
                    Console.WriteLine("[SimpleLocation: Connection failed. Error: {0}]", e.Message);
                    googleApiClient.Connect(); // There was an error with the resolution intent. Try again.
                }
            else {
                GooglePlayServicesUtil.GetErrorDialog(result.ErrorCode, context, 9000)?.Show();
                resolvingError = true;
            }
        }
예제 #24
0
 public void OnConnectionFailed(ConnectionResult result)
 {
     if (result.HasResolution)
     {
         try
         {
             result.StartResolutionForResult((Activity)context, RequestCode_RESOLUTION);
         }
         catch (IntentSender.SendIntentException e)
         {
             Console.WriteLine("Failed to start resolution result: " + e.Message);
         }
     }
     else
     {
         Console.WriteLine("Failed without resolution");
     }
 }
예제 #25
0
        public void OnConnectionFailed(ConnectionResult result)
        {
            if (resolving)
            {
                return;
            }

            if (result.HasResolution)
            {
                resolving = true;
                result.StartResolutionForResult(activity, RC_RESOLVE);
                return;
            }

            resolving = false;
            SignedOut = false;
            signingIn = false;
            OnSignInFailed?.Invoke(this, EventArgs.Empty);
        }
예제 #26
0
 public void OnConnectionFailed(ConnectionResult result)
 {
     Debug.WriteLine("Google API connection failed!");
     if (result.HasResolution)
     {
         try
         {
             Debug.WriteLine("Google API start asking");
             result.StartResolutionForResult(MainActivity.Current, RESULT_CODE);
         }
         catch (IntentSender.SendIntentException e)
         {
             // Unable to resolve, message user appropriately
         }
     }
     else
     {
         GooglePlayServicesUtil.ShowErrorDialogFragment(result.ErrorCode, MainActivity.Current, 0);
     }
 }
 protected void onConnectionFailed(ConnectionResult result)
 {
     // Called whenever the API client fails to connect.
     Log.Info(TAG, "GoogleApiClient connection failed: " + result);
     if (!result.HasResolution)
     {
         // show the localized error dialog.
         GoogleApiAvailability.Instance.GetErrorDialog(this, result.ErrorCode, 0).Show();
         return;
     }
     // The failure has a resolution. Resolve it.
     // Called typically when the app is not yet authorized, and an authorization dialog is displayed to the user.
     try
     {
         result.StartResolutionForResult(this, REQUEST_CODE_RESOLUTION);
     }
     catch (IntentSender.SendIntentException e)
     {
         Log.Error(TAG, "Exception while starting resolution activity", e);
     }
 }
예제 #28
0
        IObservable<bool> IConnectionResultHandler.HandleConnectionResult(ConnectionResult connectionResult)
        {
            if (!connectionResult.HasResolution)
            {
                GoogleApiAvailability
                    .Instance
                    .GetErrorDialog(this, connectionResult.ErrorCode, 0)
                    .Show();
                return Observable.Return(false);
            }

            try
            {
                this.resultResolutionSubject.Disposable = new Subject<bool>();
                connectionResult.StartResolutionForResult(this, RequestCodeResolution);
                return this.resultResolutionSubject.Disposable;
            }
            catch (IntentSender.SendIntentException)
            {
                return Observable.Return(false);
            }
        }
예제 #29
0
        IObservable <bool> IConnectionResultHandler.HandleConnectionResult(ConnectionResult connectionResult)
        {
            if (!connectionResult.HasResolution)
            {
                GoogleApiAvailability
                .Instance
                .GetErrorDialog(this, connectionResult.ErrorCode, 0)
                .Show();
                return(Observable.Return(false));
            }

            try
            {
                this.resultResolutionSubject.Disposable = new Subject <bool>();
                connectionResult.StartResolutionForResult(this, RequestCodeResolution);
                return(this.resultResolutionSubject.Disposable);
            }
            catch (IntentSender.SendIntentException)
            {
                return(Observable.Return(false));
            }
        }
        public void OnConnectionFailed(ConnectionResult result)
        {
            if (_resolving)
            {
                return;
            }

            if (result.HasResolution)
            {
                _resolving = true;
                result.StartResolutionForResult(AppMain.Activity, RcResolve);
                return;
            }

            GamerPlatformSettings.Instance.ShouldBeSignedIn = true;
            GamerPlatformSettings.Instance.Serialize();

            _resolving = false;
            _signingIn = false;

            OnSignInFailed(GamerError.ErrorSignIn);
        }
예제 #31
0
        public void OnConnectionFailed(ConnectionResult result)
        {
            if (resolving)
            {
                return;
            }

            if (result.HasResolution)
            {
                resolving = true;
                result.StartResolutionForResult(activity, RC_RESOLVE);
                this.adapter.OnActivityResult += this.OnConnectionFailedActivityResult;
                return;
            }

            resolving = false;
            SignedOut = false;
            signingin = false;
            if (this.OnSignInFailed != null)
            {
                this.OnSignInFailed(this, EventArgs.Empty);
            }
        }
예제 #32
0
 public void OnConnectionFailed(ConnectionResult result)
 {
     if (!mIsResolving && mShouldResolve)
     {
         if (result.HasResolution)
         {
             try
             {
                 result.StartResolutionForResult(this, RC_SIGN_IN);
                 mIsResolving = true;
             }
             catch
             {
                 mIsResolving = false;
                 mGoogleApiClient.Connect();
             }
         }
     }
     else
     {
         UpdateUI(false);
     }
 }
        public void OnConnectionFailed(ConnectionResult result)
        {
            Log.Error(TAG, "Connect to Google API failed: {0}.", result.ErrorCode);
            if (_authInProgress)
            {
                return;
            }
            if (!result.HasResolution)
            {
                return;
            }

            try
            {
                _authInProgress = true;
                result.StartResolutionForResult(this, GOOGLE_PLAY_SERVICES_REQUEST_AUTHORIZATION);
            }
            catch (IntentSender.SendIntentException e)
            {
                _authInProgress = false;
                Log.Error(TAG, "Could not resolve Google Play Services error: {0}", e.LocalizedMessage);
            }
        }
예제 #34
0
 /**
  * Resolve a connection failure from
  * {@link com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener#onConnectionFailed(com.google.android.gms.common.ConnectionResult)}
  *
  * @param activity the Activity trying to resolve the connection failure.
  * @param client the GoogleAPIClient instance of the Activity.
  * @param result the ConnectionResult received by the Activity.
  * @param requestCode a request code which the calling Activity can use to identify the result
  *                    of this resolution in onActivityResult.
  * @param fallbackErrorMessage a generic error message to display if the failure cannot be resolved.
  * @return true if the connection failure is resolved, false otherwise.
  */
 public static bool ResolveConnectionFailure(Activity activity,
                                             GoogleApiClient client, ConnectionResult result, int requestCode,
                                             string fallbackErrorMessage)
 {
     if (result.HasResolution)
     {
         try
         {
             result.StartResolutionForResult(activity, requestCode);
             return(true);
         }
         catch (IntentSender.SendIntentException e)
         {
             // The intent was canceled before it was sent.  Return to the default
             // state and attempt to connect to get an updated ConnectionResult.
             client.Connect();
             return(false);
         }
     }
     else
     {
         // not resolvable... so show an error message
         int    errorCode = result.ErrorCode;
         Dialog dialog    = GooglePlayServicesUtil.GetErrorDialog(errorCode,
                                                                  activity, requestCode);
         if (dialog != null)
         {
             dialog.Show();
         }
         else
         {
             // no built-in dialog: show the fallback error message
             ShowAlert(activity, fallbackErrorMessage);
         }
         return(false);
     }
 }
        public void OnConnectionFailed (ConnectionResult result) 
        {
            if (mResolvingError)
                return;

            mPersonListView.Adapter = null;
            try {
                result.StartResolutionForResult (this, REQUEST_CODE_SIGN_IN);
                mResolvingError = true;
            } catch (Android.Content.IntentSender.SendIntentException) {
                // Get another pending intent to run.
                mGoogleApiClient.Connect ();
            }
        }
예제 #36
0
 /// <summary>
 /// After we fail to connect to Google Play, it will tell us why. In some cases the
 /// failure reason can be automatically resolved (eg. Login Required).
 /// </summary>
 /// <param name="result">The reason we failed to connect.</param>
 private void ResolveLogin(ConnectionResult result)
 {
     // Does this failure reason have a solution?
     if (result.HasResolution) 
     {
         try 
         {
             // Try to resolve the problem automatically.
             result.StartResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR);
         } 
         catch (Android.Content.IntentSender.SendIntentException /*e*/) 
         {
             // Not really sure why this is here.
             pGooglePlayClient.Connect();
         }
     }
 }
예제 #37
0
        /// <summary>
        /// Called when [connection failed].
        /// </summary>
        /// <param name="result">The result.</param>
        public void OnConnectionFailed(ConnectionResult result)
        {
            if (this.resolving)
            {
                return;
            }

            if (result.HasResolution)
            {
                this.resolving = true;
                result.StartResolutionForResult(this.activity, RC_RESOLVE);
                this.adapter.OnActivityResult += this.OnConnectionFailedActivityResult;
                return;
            }

            this.resolving = false;
            this.SignedOut = false;
            this.signingin = false;

            if (this.OnSignInFailed != null)
            {
                this.OnSignInFailed(this, EventArgs.Empty);
            }
        }
        public void OnConnectionFailed(ConnectionResult result)
        {
            _connectStopwatch.Stop();
            Logger.Warn($"{_activity.GetType()} Google Play Services connection failed after {_connectStopwatch.ElapsedMilliseconds}ms: {result}");

            if(IsResolvingError) {
                return;
            }

            if(!result.HasResolution) {
                Logger.Debug($"{_activity.GetType()} Google Play Services connection failure has no resolution, showing error dialog...");
// TODO: if the error here is service missing, bad things happen (as per the emulator behavior)
                IsResolvingError = true;
                GoogleApiAvailability.Instance.GetErrorDialog(_activity, result.ErrorCode, 0).Show();
                IsResolvingError = false;

                OnConnected(new PlayServicesConnectedEventArgs { IsSuccess = false });
                return;
            }

            try {
                IsResolvingError = true;

                Logger.Debug($"{_activity.GetType()} Starting Google Play Services connection failure resolution activity...");
                result.StartResolutionForResult(_activity, RequestCodeResolveError);
            } catch(IntentSender.SendIntentException) {
                Logger.Error($"{_activity.GetType()} Exception while starting resolution activity, retrying connection...");
                ConnectAsync().Wait();
            }
        }
예제 #39
0
		public void OnConnectionFailed (ConnectionResult result)
		{
			if (Log.IsLoggable(Constants.TAG, LogPriority.Debug)) {
				Log.Debug (Constants.TAG, "Disconnected from Google Api Service");
			}
			if (WearableClass.NodeApi != null) {
				WearableClass.NodeApi.RemoveListener (mGoogleApiClient, this);
			}
			if (mResolvingError) {
				// Already attempting to resolve the error
				return;
			} else if (result.HasResolution) {
				try {
					mResolvingError = true;
					result.StartResolutionForResult (this, REQUEST_RESOLVE_ERROR);
				} catch {
					// There was an error with the resolution intent. Try again
					mGoogleApiClient.Connect ();
				}
			} else {
				mResolvingError = false;
			}
		}
예제 #40
0
 /// <summary>
 /// Checks to see if we have a resolution
 /// </summary>
 /// <param name="result">Result.</param>
 private void ResolveLogin(ConnectionResult result)
 {
     if (result.HasResolution) {
         try {
             result.StartResolutionForResult (this, REQUEST_CODE_RESOLVE_ERR);
         } catch (Android.Content.IntentSender.SendIntentException e) {
             plusClient.Connect ();
         }
     } else if(progressDialog != null && progressDialog.IsShowing) {
         progressDialog.Dismiss ();
     }
 }
예제 #41
0
		public void OnConnectionFailed (ConnectionResult result)
		{
			if (resolving)
				return;

			if (result.HasResolution) {
				resolving = true;
				result.StartResolutionForResult (activity, RC_RESOLVE);
				return;
			}

			resolving = false;
			SignedOut = false;
			signingin = false;
			if (OnSignInFailed != null)
				OnSignInFailed (this, EventArgs.Empty);
		}