當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。