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


Java ConnectionResult.startResolutionForResult方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:mkeresztes,项目名称:AndiCar,代码行数:18,代码来源:PreferenceActivity.java

示例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);
    }
}
 
开发者ID:SKT-ThingPlug,项目名称:thingplug-sdk-android,代码行数:20,代码来源:GoogleDriveHandler.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包/类
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

示例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();
    }
}
 
开发者ID:claudiodegio,项目名称:dbsync,代码行数:17,代码来源:BaseMainDbActivity.java

示例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));
    }
}
 
开发者ID:darsh2,项目名称:CouponsTracker,代码行数:23,代码来源:SettingsFragment.java

示例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;
    }
}
 
开发者ID:Magicrafter13,项目名称:1946,代码行数:41,代码来源:BaseGameUtils.java

示例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();
    }
}
 
开发者ID:apuder,项目名称:ActivityMonitor,代码行数:13,代码来源:DriveUploader.java

示例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();
	}
}
 
开发者ID:marpies,项目名称:game-services-ane,代码行数:22,代码来源:GameServicesHelper.java

示例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());
    }

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

示例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;
    }
}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:41,代码来源:BaseGameUtils.java

示例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();
	}
}
 
开发者ID:marpies,项目名称:game-services-ane,代码行数:11,代码来源:GameServicesHelper.java

示例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;
    }
}
 
开发者ID:TheAndroidMaster,项目名称:Asteroid,代码行数:41,代码来源:BaseGameUtils.java

示例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();
    }
}
 
开发者ID:mkeresztes,项目名称:AndiCar,代码行数:13,代码来源:TestActivity.java


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