本文整理汇总了Java中com.google.android.gms.common.ConnectionResult.startResolutionForResult方法的典型用法代码示例。如果您正苦于以下问题:Java ConnectionResult.startResolutionForResult方法的具体用法?Java ConnectionResult.startResolutionForResult怎么用?Java ConnectionResult.startResolutionForResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.common.ConnectionResult
的用法示例。
在下文中一共展示了ConnectionResult.startResolutionForResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onConnectionFailed
import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
if (mProgress != null) {
mProgress.dismiss();
}
secureBkGDriveFolderPreference.setEnabled(false);
if (connectionResult.hasResolution()) {
try {
connectionResult.startResolutionForResult(BackupRestorePreferenceFragment.this.getActivity(), ConstantValues.REQUEST_GDRIVE_AUTHORIZATION);
} catch (IntentSender.SendIntentException e) {
// Unable to resolve, message user appropriately
}
} else {
GoogleApiAvailability.getInstance().getErrorDialog(getActivity(), connectionResult.getErrorCode(), 0).show();
}
}
示例2: 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);
}
}
示例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;
}
}
示例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);
}
}
}
示例5: 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();
}
}
}
示例6: onConnectionFailed
import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.i(TAG, "onConnectionFailed:" + connectionResult.getErrorMessage());
// 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();
}
}
示例7: 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));
}
}
示例8: 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;
}
}
示例9: onConnectionFailed
import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(@NonNull ConnectionResult result) {
if (!result.hasResolution()) {
GoogleApiAvailability.getInstance().getErrorDialog(activity, result.getErrorCode(), 0).show();
return;
}
try {
result.startResolutionForResult(activity, REQUEST_CODE_RESOLUTION);
} catch (IntentSender.SendIntentException e) {
uploadFailed();
}
}
示例10: resolveSignInConnectionResult
import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
/**
*
*
* Private API
*
*
*/
private void resolveSignInConnectionResult( @NonNull ConnectionResult connectionResult ) {
AIR.log( "GameServicesHelper::resolveSignInConnectionResult ErrorCode:" + connectionResult.getErrorCode() );
mUserAuth = false;
mPendingConnectionResult = null;
try {
connectionResult.startResolutionForResult( AIR.getContext().getActivity(), AUTH_RESULT_CODE );
AIR.dispatchEvent( GameServicesEvent.WILL_PRESENT_AUTH_DIALOG );
} catch( IntentSender.SendIntentException e ) {
e.printStackTrace();
mGoogleApiClient.connect();
}
}
示例11: 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());
}
}
示例12: 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;
}
}
示例13: resolvePendingAchievementsUIError
import com.google.android.gms.common.ConnectionResult; //导入方法依赖的package包/类
private void resolvePendingAchievementsUIError( @NonNull ConnectionResult connectionResult ) {
AIR.log( "GameServicesHelper::resolveSignInConnectionResult ErrorCode:" + connectionResult.getErrorCode() );
try {
connectionResult.startResolutionForResult( AIR.getContext().getActivity(), AUTH_RESULT_CODE );
} catch( IntentSender.SendIntentException e ) {
e.printStackTrace();
mGoogleApiClient.connect();
}
}
示例14: 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;
}
}
示例15: 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();
}
}