Code example for ConnectionResult

Methods: getErrorCodehasResolutionstartResolutionForResult

	 * Attempts to resolve a connection failure. This will usually involve starting a UI flow that lets the user give the appropriate consents necessary for sign-in to work. 
	void resolveConnectionResult() { 
		// Try to resolve the problem 
		debugLog("resolveConnectionResult: trying to resolve result: " + mConnectionResult);
		if (mConnectionResult.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) 
				mExpectingActivityResult = true;
				mConnectionResult.startResolutionForResult(mActivity, RC_RESOLVE);
			} catch (SendIntentException e) {
				// Try connecting again 
		} 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."); 
	 * Give up on signing in due to an error. Shows the appropriate error message to the user, using a standard error dialog as appropriate to the cause of the error. That dialog will indicate to the user how the problem can be solved (for example, re-enable Google Play Services, upgrade to a new version, etc). 
	void giveUp() { 
		mSignInError = true;
		mAutoSignIn = false;
		debugLog("giveUp: giving up on connection. " + 
				((mConnectionResult == null) ? "(no connection result)" :
						("Status code: " + mConnectionResult.getErrorCode())));
		Dialog errorDialog = null;
		if (mConnectionResult != null) {
			// get error dialog for that specific problem 
			errorDialog = getErrorDialog(mConnectionResult.getErrorCode());;
			if (mListener != null) {
		} else { 
Contextual code suggestions in your IDE  Get Codota for Java