• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UserRecoverableAuthIOException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: onError

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
public void onError(Throwable error) {
    LocalMessage.Status status = LocalMessage.Status.CANCEL;

    // YEAH :D
    while (error instanceof UserRecoverableAuthIOException) {
        error = ((UserRecoverableAuthIOException) error).getCause();
    }

    if (error instanceof UserRecoverableAuthException) {
        status = LocalMessage.Status.CANCEL_RECOVERABLE_AUTH_ERROR;
        MainActivity.notifyUserRecoverableAuthException(
                application, message, (UserRecoverableAuthException) error);
    } else {
        Timber.e(error, "Message submission failed.");
        notifyError(error);
    }

    messages.setStatus(message.getId(), status);
}
 
开发者ID:labhackercd,项目名称:edm,代码行数:20,代码来源:AddMessageTask.java


示例17: doInBackground

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
/**
 * Background task to call Google Calendar API.
 * @param params no parameters needed for this task.
 */
@Override
protected Void doInBackground(Void... params) {
    try {
        mActivity.clearResultsText();
        mActivity.updateResultsText(getDataFromApi());

    } catch (final GooglePlayServicesAvailabilityIOException availabilityException) {
        mActivity.showGooglePlayServicesAvailabilityErrorDialog(
                availabilityException.getConnectionStatusCode());

    } catch (UserRecoverableAuthIOException userRecoverableException) {
        mActivity.startActivityForResult(
                userRecoverableException.getIntent(),
                MainActivity.REQUEST_AUTHORIZATION);

    } catch (IOException e) {
        mActivity.updateStatus("The following error occurred: " +
                e.getMessage());
    }
    return null;
}
 
开发者ID:miguelarauj1o,项目名称:CalendarQuickStart,代码行数:26,代码来源:ApiAsyncTask.java


示例18: handleException

import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; //导入依赖的package包/类
void handleException(Throwable e, Subscriber<?> subscriber) {
    Timber.e(e, "handleException");
    LibraryException ex = null;
    if (e instanceof UserRecoverableAuthIOException) {
        ex = new LibraryException(AUTH_FAILURE, e);
    } else if (e instanceof GoogleAuthIOException) {
        removeAccount();
        ex = new LibraryException(AUTH_FAILURE, e);
    } else if (e instanceof IOException) {
        ex = new LibraryException(NETWORK, e);
    } else {
        ex = new LibraryException(UNKNOWN, e);
    }
    if (subscriber != null && !subscriber.isUnsubscribed()) {
        subscriber.onError(ex);
    }
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:18,代码来源:DriveClient.java


示例19: 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) {
            AuthManager.showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) mLastError)
                            .getConnectionStatusCode(), mActivity);
        } else if (mLastError instanceof UserRecoverableAuthIOException) {
            AuthManager.setAuthReason(AuthManager.CREATING);
            mActivity.startActivityForResult(
                    ((UserRecoverableAuthIOException) mLastError).getIntent(),
                    AuthManager.REQUEST_AUTHORIZATION);
        } else {
            String errorMsg = mActivity.getString(R.string.sheet_create_error) + mLastError.getMessage();
            Toast.makeText(mActivity, errorMsg, Toast.LENGTH_SHORT).show();
        }
    } else {
        Toast.makeText(mActivity, R.string.sheet_create_cancel, Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:ACLay,项目名称:TATupload,代码行数:22,代码来源:MakeSheetTask.java


示例20: 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) {
            AuthManager.showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) mLastError)
                            .getConnectionStatusCode(), mActivity);
        } else if (mLastError instanceof UserRecoverableAuthIOException) {
            AuthManager.setAuthReason(AuthManager.UPLOADING);
            mActivity.startActivityForResult(
                    ((UserRecoverableAuthIOException) mLastError).getIntent(),
                    AuthManager.REQUEST_AUTHORIZATION);
        } else {
            String errorMsg = mActivity.getString(R.string.text_upload_error) + mLastError.getMessage();
            Toast.makeText(mActivity, errorMsg, Toast.LENGTH_SHORT).show();
        }
    } else {
        Toast.makeText(mActivity, R.string.text_upload_cancel, Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:ACLay,项目名称:TATupload,代码行数:22,代码来源:ForegroundUploadTask.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConversionException类代码示例发布时间:2022-05-21
下一篇:
Java TLongObjectHashMap类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap