Android ConnectionResult - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ConnectionResult class.

This code example shows how to use the following methods: getErrorCode, hasResolution, startResolutionForResult
     * 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 
                debugLog("SendIntentException."); 
                connectCurrentClient(); 
            } 
        } else { 
            // It's not a problem what we can solve, so give up and show an 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getErrorCode, hasResolution, startResolutionForResult
 
    /** 
     * Perform resolution given a non-null result. 
     */ 
    private void resolveLastResult() { 
        if (GooglePlayServicesUtil.isUserRecoverableError(mLastConnectionResult.getErrorCode())) {
        	// Show a dialog to install or enable Google Play services. 
        	showErrorDialog(ErrorDialogFragment.create(mLastConnectionResult.getErrorCode(),
        			mRequestCode));
            return; 
        } 
 
        if (mLastConnectionResult.hasResolution()) {
            startResolution(); 
        } 
    } 
     
    public static final class ErrorDialogFragment extends GooglePlayServicesErrorDialogFragment { 
 
        public static ErrorDialogFragment create(int errorCode, int requestCode) {

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getErrorCode, toString
		mLocationClient.disconnect();
	} 
 
	@Override 
	public void onConnectionFailed(ConnectionResult arg0) {
		Log.w(LOG,"location connect failed: " + arg0.getErrorCode() + "=" + arg0.toString());
		 
	} 
 
	@Override 
	public void onConnected(Bundle arg0) {
		 
 
		mLocationRequest = LocationRequest.create();
 
		mLocationRequest.setInterval(Geo.LOG_RATE);
 
		mLocationClient.requestLocationUpdates(mLocationRequest, this);
		 
	} 
Full Snippet Info
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getErrorCode, hasResolution
    } 
     
    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;
                debugLog("Resolving intent with activity "+mParentActivity);
                // create dummy activity 
                /*mDummyActivity = new DummyActivity(); 
                Intent intent = new Intent(); 
                mDummyActivity.startActivity(intent);*/ 
                 
                Intent intent = new Intent(mParentActivity, DummyActivity.class);
    			intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getErrorCode, hasResolution, startResolutionForResult
     * 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 
                debugLog("SendIntentException."); 
                connectCurrentClient(); 
            } 
        } 
        else { 
            // It's not a problem what we can solve, so give up and show an error. 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getErrorCode, startResolutionForResult, toString
		Toast.makeText(this, "disconnected", Toast.LENGTH_SHORT).show();
	} 
 
	@Override 
	public void onConnectionFailed(ConnectionResult arg0) {
		Log.i("plus", "Error code is " + arg0.getErrorCode() + " the solution is " + arg0.toString());
		Toast.makeText(this, "connectiong failed", Toast.LENGTH_SHORT).show();
		if(arg0.getErrorCode() == 4){
			try { 
				arg0.startResolutionForResult(this, 1);
			} catch (SendIntentException e) {
				e.printStackTrace();
			} 
		} 
	} 
 
	@Override 
	public void onClick(View v) {
		if(mClient.isConnected())
			return; 
Full Snippet Info
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getErrorCode, hasResolution, startResolutionForResult
     * 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 
                debugLog("SendIntentException."); 
                connectCurrentClient(); 
            } 
        } else { 
            // It's not a problem what we can solve, so give up and show an 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getErrorCode, hasResolution, startResolutionForResult
 
    /** 
     * Perform resolution given a non-null result. 
     */ 
    private void resolveLastResult() { 
        if (GooglePlayServicesUtil.isUserRecoverableError(mLastConnectionResult.getErrorCode())) {
            // Show a dialog to install or enable Google Play services. 
            showErrorDialog(ErrorDialogFragment.create(mLastConnectionResult.getErrorCode(),
                mRequestCode));
            return; 
        } 
 
        if (mLastConnectionResult.hasResolution()) {
            startResolution(); 
        } 
    } 
     
    public static final class ErrorDialogFragment extends GooglePlayServicesErrorDialogFragment { 
 
        public static ErrorDialogFragment create(int errorCode, int requestCode) {

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: hasResolution, startResolutionForResult
         * Google Play services can resolve some errors it detects. 
         * If the error has a resolution, try sending an Intent to 
         * start a Google Play services activity that can resolve 
         * error. 
         */ 
		if (connectionResult.hasResolution()) {
			try { 
				connectionResult.startResolutionForResult(getActivity(), CONNECTION_FAILURE_RESOLUTION_REQUEST);
			} catch (IntentSender.SendIntentException e) {
				e.printStackTrace();
			} 
		} 
 
	} 
} 
Full Snippet Info
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getErrorCode, hasResolution, startResolutionForResult
 
    /** 
     * Perform resolution given a non-null result. 
     */ 
    private void resolveLastResult() { 
        if (GooglePlayServicesUtil.isUserRecoverableError(mLastConnectionResult.getErrorCode())) {
            // Show a dialog to install or enable Google Play services. 
            showErrorDialog(ErrorDialogFragment.create(mLastConnectionResult.getErrorCode(),
                    mRequestCode));
            return; 
        } 
 
        if (mLastConnectionResult.hasResolution()) {
            startResolution(); 
        } 
    } 
 
    public static final class ErrorDialogFragment extends GooglePlayServicesErrorDialogFragment { 
 
        public static ErrorDialogFragment create(int errorCode, int requestCode) {

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android ConnectionResult Questions & Answers:

Other Android ConnectionResult Examples

1:		public void onConnectionFailed(ConnectionResult result) {
2:			if (!result.hasResolution()) {
3:				GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), this,

Read More

30:		private boolean mSignInClicked;
31:	
32:		private ConnectionResult mConnectionResult;
33:	
34:		private SignInButton btnSignIn;

Read More

51:		private boolean mSignInClicked;
52:	
53:		private ConnectionResult mConnectionResult;
54:	
55:		private SignInButton btnSignIn;
-
111:	
112:		@Override
113:		public void onConnectionFailed(ConnectionResult result) {
114:			if (!result.hasResolution()) {
115:				GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), this,

Read More

See Code Examples for Android ConnectionResult Methods: