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


Java UserRecoverableAuthIOException类代码示例

本文整理汇总了Java中com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException的典型用法代码示例。如果您正苦于以下问题:Java UserRecoverableAuthIOException类的具体用法?Java UserRecoverableAuthIOException怎么用?Java UserRecoverableAuthIOException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UserRecoverableAuthIOException类属于com.google.api.client.googleapis.extensions.android.gms.auth包,在下文中一共展示了UserRecoverableAuthIOException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doInBackground

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
/**
 * Background task to call Gmail API.
 * @param queries the gmail api query.
 */
@Override
protected List<String> doInBackground(String... queries) {

    try {
        return getDataFromApi(queries[0]);
    } catch (Exception e) {
        if (e instanceof UserRecoverableAuthIOException) {
            Intent authorizationIntent = new Intent(getContext(),
                    GmailAuthorizationActivity.class)
                    .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

            authorizationIntent.setAction("UserRecoverableAuthIOException");
            authorizationIntent.putExtra("request_authorization",
                    ((UserRecoverableAuthIOException) e).getIntent());

            getContext().startActivity(authorizationIntent);
        } else {
            Logging.error("The following error occurred:\n"
                    + e.getMessage());
        }
        return null;
    }

}
 
开发者ID:PrivacyStreams,项目名称:PrivacyStreams,代码行数:29,代码来源:BaseGmailProvider.java

示例2: convertException

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
private Exception convertException(Exception e) {
	logDebug("Exception: " + e.toString());
	e.printStackTrace();
	if (UserRecoverableAuthIOException.class.isAssignableFrom(e.getClass()))
	{
		logDebug("clearing account data.");
		//this is not really nice because it removes data from the cache which might still be valid but we don't have the account name here...
		mAccountData.clear();
	}
	if (GoogleJsonResponseException.class.isAssignableFrom(e.getClass()) )
	{
		GoogleJsonResponseException jsonEx = (GoogleJsonResponseException)e;
		if (jsonEx.getDetails().getCode() == 404)
			return new FileNotFoundException(jsonEx.getMessage());
	}
	
	return e;
	
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:20,代码来源:GoogleDriveFileStorage.java

示例3: onCancelled

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
@Override
protected void onCancelled() {
    context.hideLoadingScreen();
    if (mLastError != null) {
        if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
            showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) mLastError)
                            .getConnectionStatusCode());
        } else if (mLastError instanceof UserRecoverableAuthIOException) {
            context.startActivityForResult(
                    ((UserRecoverableAuthIOException) mLastError).getIntent(),
                    REQUEST_AUTHORIZATION);
        } else {
            context.showError("The following error occurred:\n"
                    + mLastError.getMessage(),context);
        }
    } else {
        context.showError("Request cancelled.",context);
    }
}
 
开发者ID:Pl4gue,项目名称:homeworkManager-android,代码行数:21,代码来源:GetHomeworkPresenter.java

示例4: onCancelled

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
@Override
protected void onCancelled() {
    context.hideLoadingScreen();
    context.enableFields();
    if (mLastError != null) {
        if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
            showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) mLastError)
                            .getConnectionStatusCode());
        } else if (mLastError instanceof UserRecoverableAuthIOException) {
            context.startActivityForResult(
                    ((UserRecoverableAuthIOException) mLastError).getIntent(),
                    REQUEST_AUTHORIZATION);
        } else {
            context.showError("The following error occurred:\n"
                    + mLastError.getMessage(),context);
        }
    } else {
        context.showError("Request cancelled.",context);
    }
}
 
开发者ID:Pl4gue,项目名称:homeworkManager-android,代码行数:22,代码来源:AddHomeworkPresenter.java

示例5: onAsyncTaskCancel

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
@Override
public void onAsyncTaskCancel(Exception mLastError) {
    mProgress.hide();
    if (mLastError != null) {
        if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
            showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) mLastError)
                            .getConnectionStatusCode());
        } else if (mLastError instanceof UserRecoverableAuthIOException) {
            startActivityForResult(
                    ((UserRecoverableAuthIOException) mLastError).getIntent(),
                    REQUEST_AUTHORIZATION);
        } else {
            mOutputText.setTextColor(ContextCompat.getColor(getContext(), RED_WARN_COLOR));
            if (mLastError instanceof GoogleAuthIOException) {
                Log.e(LOG_TAG,"Authentication error occured when calling Google Drive API.", mLastError);
                mOutputText.setText(R.string.googleDrive_authErr);
            } else {
                mOutputText.setText(getString(R.string.googleDrive_errOccurred, mLastError.getMessage()));
            }
        }
    } else {
        mOutputText.setTextColor(ContextCompat.getColor(getContext(), RED_WARN_COLOR));
        mOutputText.setText(R.string.googleDrive_cancelledRequest);
    }
}
 
开发者ID:piskula,项目名称:FuelUp,代码行数:27,代码来源:BackupFragment.java

示例6: onAsyncTaskCancel

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
@Override
public void onAsyncTaskCancel(Exception mLastError) {
    Log.e(LOG_TAG, "async error");
    if (mLastError != null) {
        if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
            showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) mLastError)
                            .getConnectionStatusCode());
        } else if (mLastError instanceof UserRecoverableAuthIOException) {
            startActivityForResult(
                    ((UserRecoverableAuthIOException) mLastError).getIntent(),
                    REQUEST_AUTHORIZATION);
        } else {
            if (mLastError instanceof GoogleAuthIOException) {
                Log.e(LOG_TAG,"Authentication error occured when calling Google Drive API.", mLastError);
                txtStatus.setText(R.string.googleDrive_authErr);
            } else {
                txtStatus.setText(getString(R.string.googleDrive_errOccurred, mLastError.getMessage()));
            }
        }
    } else {
        txtStatus.setText(R.string.googleDrive_cancelledRequest);
    }
}
 
开发者ID:piskula,项目名称:FuelUp,代码行数:25,代码来源:CheckPermissionsActivity.java

示例7: onCancelled

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
@Override
protected void onCancelled() {
    mProgress.hide();
    if (mLastError != null) {
        if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
            showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) mLastError)
                            .getConnectionStatusCode());
        } else if (mLastError instanceof UserRecoverableAuthIOException) {
            startActivityForResult(
                    ((UserRecoverableAuthIOException) mLastError).getIntent(),
                    CheckupReminders.REQUEST_AUTHORIZATION);
        } else {
            //mOutputText.setText("The following error occurred:\n"+ mLastError.getMessage());
        }
    } else {
        //  mOutputText.setText("Request cancelled.");
    }
}
 
开发者ID:webianks,项目名称:Crimson,代码行数:20,代码来源:CheckupReminders.java

示例8: onCancelled

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
@Override
protected void onCancelled() {
    mProgress.hide();
    if (mLastError != null) {
        if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
            showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) mLastError)
                            .getConnectionStatusCode());
        } else if (mLastError instanceof UserRecoverableAuthIOException) {
            startActivityForResult(
                    ((UserRecoverableAuthIOException) mLastError).getIntent(),
                    ClockActivity.REQUEST_AUTHORIZATION);
        } else {
            Toast.makeText(ClockActivity.this,"The following error occurred:\n"
                    + mLastError.getMessage(),Toast.LENGTH_SHORT).show();
        }
    } else {
        Toast.makeText(ClockActivity.this,"Request cancelled.",Toast.LENGTH_SHORT).show();

    }
}
 
开发者ID:jcolladosp,项目名称:ePills,代码行数:22,代码来源:ClockActivity.java

示例9: onAndiCarTaskCancelled

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
@Override
public void onAndiCarTaskCancelled(String errorMsg, Exception e) {
    if (mProgress != null) {
        mProgress.dismiss();
    }
    if (e != null) {
        if (e instanceof GooglePlayServicesAvailabilityIOException) {
            showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) e).getConnectionStatusCode());
        } else if (e instanceof UserRecoverableAuthIOException) {
            getActivity().startActivityForResult(
                    ((UserRecoverableAuthIOException) e).getIntent(), ConstantValues.REQUEST_GMAIL_AUTHORIZATION);
        } else {
            Utils.showReportableErrorDialog(getActivity(), errorMsg, null, e);
            Log.d("SendGMailTask", "The following error occurred:\n" + e.getMessage(), e);
        }
    } else {
        Utils.showNotReportableErrorDialog(getActivity(), errorMsg, null);
        Log.d("SendGMailTask", "Request cancelled: " + errorMsg);
    }

}
 
开发者ID:mkeresztes,项目名称:AndiCar,代码行数:23,代码来源:PreferenceActivity.java

示例10: onCancelled

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
@Override
protected void onCancelled() {
    mProgress.hide();
    if (mLastError != null) {
        if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
            showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) mLastError)
                            .getConnectionStatusCode());
        } else if (mLastError instanceof UserRecoverableAuthIOException) {
            startActivityForResult(
                    ((UserRecoverableAuthIOException) mLastError).getIntent(),
                    GoogleBackup.REQUEST_AUTHORIZATION);
        } else {
            mOutputText.setText("The following error occurred:\n"
                    + mLastError.getMessage());
        }
    } else {
        mOutputText.setText("Request cancelled.");
    }
}
 
开发者ID:JonathanImperato,项目名称:Service-Notes,代码行数:21,代码来源:GoogleBackup.java

示例11: onCalendarUpdateError

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
@Override
public void onCalendarUpdateError(Exception error)
{
    if (error != null)
    {
        if (error instanceof GooglePlayServicesAvailabilityIOException)
        {
            final int code = ((GooglePlayServicesAvailabilityIOException) error)
                    .getConnectionStatusCode();
            showGooglePlayServicesAvailabilityErrorDialog(code);
        }
        else if (error instanceof UserRecoverableAuthIOException)
        {
            startActivityForResult(((UserRecoverableAuthIOException) error).getIntent(),
                    REQUEST_AUTHORIZATION);
        }
        else
        {
            showMessage("An error occurred. If the problem persists, please contact ICB");
        }
    }
    else
    {
        showMessage("Request Cancelled");
    }
}
 
开发者ID:amrabed,项目名称:Iqama,代码行数:27,代码来源:Main.java

示例12: onCancelled

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
@Override
protected void onCancelled() {
    mProgress.dismiss();
    if (mLastError != null) {
        if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
            showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) mLastError)
                            .getConnectionStatusCode());
        } else if (mLastError instanceof UserRecoverableAuthIOException) {
            startActivityForResult(
                    ((UserRecoverableAuthIOException) mLastError).getIntent(),
                    1001);
        } else {
            //mOutputText.setText("The following error occurred:\n"
            //+ mLastError.getMessage());
        }
    } else {
        //mOutputText.setText("Request cancelled.");
    }
}
 
开发者ID:ThisChessPlayer,项目名称:GroupScheduleCoordinator,代码行数:21,代码来源:MainActivity.java

示例13: onCancelled

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
@Override
protected void onCancelled() {
    mProgress.hide();
    if (mLastError != null) {
        if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
            showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) mLastError)
                            .getConnectionStatusCode());
        } else if (mLastError instanceof UserRecoverableAuthIOException) {
            startActivityForResult(
                    ((UserRecoverableAuthIOException) mLastError).getIntent(),
                    Utils.REQUEST_AUTHORIZATION);
        } else {
            showMessage(view, "The following error occurred:\n" + mLastError);
            Log.v("Error", mLastError + "");
        }
    } else {
        showMessage(view, "Request Cancelled.");
    }
}
 
开发者ID:androidmads,项目名称:JavaMailwithGmailApi,代码行数:21,代码来源:MainActivity.java

示例14: onCancelled

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
@Override
protected void onCancelled() {

    //Need to complete credentials (ack from user first time)
    if (mLastError instanceof UserRecoverableAuthIOException) {
        DashboardActivity.dashboardActivity.startActivityForResult(
                ((UserRecoverableAuthIOException) mLastError).getIntent(),
                DriveRestControllerStrategy.REQUEST_AUTHORIZATION);
        return;
    }

    //Real connection google error
    if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
        DriveRestControllerStrategy.getInstance().showGooglePlayServicesAvailabilityErrorDialog(
                ((GooglePlayServicesAvailabilityIOException) mLastError)
                        .getConnectionStatusCode());
        return;
    }

    //Other error
    Log.e(TAG, "onCancelled: " + mLastError == null ? "" : mLastError.getMessage());
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:23,代码来源:DownloadMediaTask.java

示例15: onCancelled

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
@Override
protected void onCancelled() {

    //Need to complete credentials (ack from user first time)
    if (mLastError instanceof UserRecoverableAuthIOException) {
        DashboardActivity.dashboardActivity.startActivityForResult(
                ((UserRecoverableAuthIOException) mLastError).getIntent(),
                DriveRestController.REQUEST_AUTHORIZATION);
        return;
    }

    //Real connection google error
    if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
        DriveRestController.getInstance().showGooglePlayServicesAvailabilityErrorDialog(
                ((GooglePlayServicesAvailabilityIOException) mLastError)
                        .getConnectionStatusCode());
        return;
    }

    //Other error
    Log.e(TAG, "onCancelled: " + mLastError == null ? "" : mLastError.getMessage());
}
 
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:23,代码来源:DownloadMediaTask.java


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