当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionResult.hasResolution方法代码示例

本文整理汇总了Java中com.google.android.gms.common.ConnectionResult.hasResolution方法的典型用法代码示例。如果您正苦于以下问题:Java ConnectionResult.hasResolution方法的具体用法?Java ConnectionResult.hasResolution怎么用?Java ConnectionResult.hasResolution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.common.ConnectionResult的用法示例。


在下文中一共展示了ConnectionResult.hasResolution方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult m_result) {
	Utils.d("Google:Connection:Failed");

	if (isResolvingConnectionFailure) { return; }
	if(!isIntentInProgress && m_result.hasResolution()) {
		try {
			isIntentInProgress = true;

			activity.startIntentSenderForResult(
			m_result.getResolution().getIntentSender(),
			Utils.FIREBASE_GOOGLE_SIGN_IN, null, 0, 0, 0);

		} catch (SendIntentException ex) {
			isIntentInProgress = false;
			signIn();
		}

		isResolvingConnectionFailure = true;
		Utils.d("Google:Connection:Resolving.");
               }
}
 
开发者ID:FrogSquare,项目名称:GodotFireBase,代码行数:23,代码来源:GoogleSignIn.java

示例2: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed( @NonNull ConnectionResult connectionResult ) {
	AIR.log( "GameServicesHelper | connection FAILED" );
	AIR.log( "Error message: " + connectionResult.getErrorMessage() );
	AIR.log( "Error code: " + connectionResult.getErrorCode() );

	if( !connectionResult.isSuccess() && connectionResult.hasResolution() ) {
		if( mPendingAchievementsUI ) {
			AIR.log( "GameServicesHelper | failed to connect with Google client, resolution available" );
			mPendingAchievementsUI = false;
			resolvePendingAchievementsUIError( connectionResult );
		}
		/* Start resolution intent only if the user requested auth himself */
		else if( mUserAuth ) {
			AIR.log( "GameServicesHelper | failed to connect with Google client, resolution available" );
			resolveSignInConnectionResult( connectionResult );
		} else {
			AIR.log( "GameServicesHelper | not starting auth resolution intent because user has not made the auth request himself" );
			mPendingConnectionResult = connectionResult;
		}
	} else {
		AIR.log( "GameServicesHelper | failed to connect with Google client, no resolution" );
	}
}
 
开发者ID:marpies,项目名称:game-services-ane,代码行数:25,代码来源:GameServicesHelper.java

示例3: resolveConnectionFailure

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
/**
 * 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 boolean resolveConnectionFailure(Activity activity,
                                               GoogleApiClient client, ConnectionResult result, int requestCode,
                                               int 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.getErrorCode();
        Dialog dialog = GooglePlayServicesUtil.getErrorDialog(errorCode,
                activity, requestCode);
        if (dialog != null) {
            dialog.show();
        } else {
            // no built-in dialog: show the fallback error message
            showAlert(activity, activity.getString(fallbackErrorMessage));
        }
        return false;
    }
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:41,代码来源:BaseGameUtils.java

示例4: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {

    if (!isResolving && shouldResolve) {
        if (connectionResult.hasResolution()) {
            try {
                connectionResult.startResolutionForResult(fragment.getActivity(), RC_SIGN_IN);
                isResolving = true;
            } catch (IntentSender.SendIntentException e) {
                isResolving = false;
                googleApiClient.connect();
            }
        } else {
            showErrorDialog(connectionResult);
        }
    }
}
 
开发者ID:moldedbits,项目名称:argus-android,代码行数:18,代码来源:GoogleHelper.java

示例5: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
    if (mResolvingConnectionError) {
        return;
    } else if (connectionResult.hasResolution()) {
        try {
            mResolvingConnectionError = true;
            connectionResult.startResolutionForResult(this, REQUEST_RESOLVE_CONNECTION_ERROR);
        } catch (IntentSender.SendIntentException e) {
            // There was an error with the resolution intent. Try again.
            mGoogleApiClient.connect();
        }
    } else {
        // Show dialog using GoogleApiAvailability.getErrorDialog()
        showErrorDialog(connectionResult.getErrorCode());
        mResolvingConnectionError = true;
    }
}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:19,代码来源:MainActivity.java

示例6: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
    Toast.makeText(this, "onConnectionFailed:" + connectionResult.getErrorMessage(), Toast.LENGTH_SHORT).show();

    // Viene chiamata nel caso la connect fallisca ad esempio
    // non è ancora stata data autorizzaiozne alla applicazione corrente
    if (connectionResult.hasResolution()) {
        try {
            connectionResult.startResolutionForResult(this, RESOLVE_CONNECTION_REQUEST_CODE);
        } catch (IntentSender.SendIntentException e) {
            // Unable to resolve, message user appropriately
        }
    } else {
        GoogleApiAvailability.getInstance().getErrorDialog(this, connectionResult.getErrorCode(), 0).show();
    }
}
 
开发者ID:claudiodegio,项目名称:dbsync,代码行数:17,代码来源:TestGDriveActivity.java

示例7: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
public void onConnectionFailed(ConnectionResult connectionResult) {
    /*
     * 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 {
            // Start an Activity that tries to resolve the error
            connectionResult.startResolutionForResult(
                    this,
                    ValueHelper.CONNECTION_FAILURE_RESOLUTION_REQUEST);
            /*
             * Thrown if Google Play services canceled the original
             * PendingIntent
             */
        } catch (IntentSender.SendIntentException e) {
            // Log the error
            e.printStackTrace();
        }
    }

}
 
开发者ID:Greenstand,项目名称:treetracker-android,代码行数:25,代码来源:MainActivity.java

示例8: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
    // Called whenever the API client fails to connect.
    Log.i(TAG, "GoogleApiClient connection failed: " + connectionResult.toString());
    if (!connectionResult.hasResolution()) {
        // show the localized error dialog.
        GoogleApiAvailability.getInstance().getErrorDialog(activity, connectionResult.getErrorCode(), 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 {
        connectionResult.startResolutionForResult(activity, CONNECTION_FAILED_POPUP);
    } catch (IntentSender.SendIntentException e) {
        Log.e(TAG, "Exception while starting resolution activity", e);
    }
}
 
开发者ID:SKT-ThingPlug,项目名称:thingplug-sdk-android,代码行数:20,代码来源:GoogleDriveHandler.java

示例9: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
    DebugLog.logMethod();
    DebugLog.logMessage("ConnectionResult: " + connectionResult.toString());
    DebugLog.logMessage("ConnectionResult error: " + connectionResult.getErrorCode() + "\n" + connectionResult.getErrorMessage());
    if (!connectionResult.hasResolution()) {
        GoogleApiAvailability.getInstance()
                .getErrorDialog(getActivity(), connectionResult.getErrorCode(), 0)
                .show();
        return;
    }

    try {
        connectionResult.startResolutionForResult(getActivity(), Constants.CONNECTION_RESOLUTION_REQUEST_CODE);
        connectionFailed = true;
    } catch (IntentSender.SendIntentException e) {
        // Unable to resolve, message user appropriately
        e.printStackTrace();
        DebugLog.logMessage(e.getMessage());
        Utilities.showToast(getActivity(), getString(R.string.google_drive_no_resolution));
    }
}
 
开发者ID:darsh2,项目名称:CouponsTracker,代码行数:23,代码来源:SettingsFragment.java

示例10: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
    if (connectionResult.hasResolution()) {
        try {
            connectionResult.startResolutionForResult(this, RESOLVE_CONNECTION_REQUEST_CODE);
        } catch (IntentSender.SendIntentException e) {
            Toast.makeText(getApplicationContext(), getString(R.string.drive_fail_connect), Toast.LENGTH_LONG).show();
        }
    }
}
 
开发者ID:JeanBarriere,项目名称:Note,代码行数:11,代码来源:MainActivity.java

示例11: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
    // Could not connect to Google Play Services.  The user needs to select an account,
    // grant permissions or resolve an error in order to sign in. Refer to the javadoc for
    // ConnectionResult to see possible error codes.
    Log.d(Constants.TAG_LOGIN, "onConnectionFailed:" + connectionResult);
    ringProgressDialog.dismiss();

    if (!mIsResolving && mShouldResolve) {
        if (connectionResult.hasResolution()) {
            try {
                connectionResult.startResolutionForResult(this, RC_SIGN_IN);
                mIsResolving = true;
            } catch (IntentSender.SendIntentException e) {
                Log.e(Constants.TAG_LOGIN, "Could not resolve ConnectionResult.", e);
                Toast.makeText(LoginActivity.this, "Could not resolve ConnectionResult", Toast.LENGTH_LONG).show();
                mIsResolving = false;
            }
        } else {
            // Could not resolve the connection result, show the user an
            // error dialog.
            Toast.makeText(LoginActivity.this, "Error on Login, check your google + login method", Toast.LENGTH_LONG).show();
        }
    } else {
        // Show the signed-out UI
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:LoginActivity.java

示例12: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
    if (connectionResult.hasResolution()) {
        try {
            connectionResult.startResolutionForResult(this, REQUEST_CODE_RESOLVE_CONNECTION);
        } catch (IntentSender.SendIntentException e) {
            // Unable to resolve, message user appropriately
        }
    } else {
        GooglePlayServicesUtil.getErrorDialog(connectionResult.getErrorCode(), this, 0).show();
    }
}
 
开发者ID:mkeresztes,项目名称:AndiCar,代码行数:13,代码来源:TestActivity.java

示例13: resolveConnectionFailure

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
/**
 * 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 boolean 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.getErrorCode();
        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;
    }
}
 
开发者ID:MrStahlfelge,项目名称:gdx-gamesvcs,代码行数:41,代码来源:BaseGameUtils.java

示例14: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
    if (connectionResult.hasResolution()) {
        try {
            connectionResult.startResolutionForResult(mContext, CONNECTION_FAILURE_RESOLUTION);
        } catch (IntentSender.SendIntentException e) {
            Log.wtf(TAG, "Location services connection failed.", e);
        }
    } else {
        Log.wtf(TAG, "Location services connection failed with code "
                + connectionResult.getErrorCode());
    }
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:14,代码来源:LocationAdapter.java

示例15: onConnectionFailed

import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {

    if (connectionResult.hasResolution()) {
        try {
            // Start an Activity that tries to resolve the error
            connectionResult.startResolutionForResult(this, 9000);
        } catch (IntentSender.SendIntentException e) {
            e.printStackTrace();
        }
    } else {
        Log.i("a", "Location services connection failed with code " + connectionResult.getErrorCode());
    }

}
 
开发者ID:prabhavgupta,项目名称:BookED,代码行数:16,代码来源:MapsActivity.java


注:本文中的com.google.android.gms.common.ConnectionResult.hasResolution方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。