本文整理汇总了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;
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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.");
}
}
示例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();
}
}
示例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);
}
}
示例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.");
}
}
示例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");
}
}
示例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.");
}
}
示例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.");
}
}
示例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());
}
示例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());
}