本文整理汇总了Java中com.google.android.gms.auth.api.credentials.CredentialRequestResult类的典型用法代码示例。如果您正苦于以下问题:Java CredentialRequestResult类的具体用法?Java CredentialRequestResult怎么用?Java CredentialRequestResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CredentialRequestResult类属于com.google.android.gms.auth.api.credentials包,在下文中一共展示了CredentialRequestResult类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: requestCredentialAndAutoSignIn
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
private void requestCredentialAndAutoSignIn() {
// disable auto sign in
if(mDisableAutoSignIn)
Auth.CredentialsApi.disableAutoSignIn(mCredentialsApiClient);
Auth.CredentialsApi.request(mCredentialsApiClient, mCredentialRequest).setResultCallback(
new ResultCallback<CredentialRequestResult>() {
@Override
public void onResult(@NonNull CredentialRequestResult credentialRequestResult) {
if(credentialRequestResult.getStatus().isSuccess())
onCredentialRetrieved(credentialRequestResult.getCredential());
else
resolveResult(credentialRequestResult.getStatus());
}
});
}
开发者ID:pchmn,项目名称:RxSocialAuth,代码行数:17,代码来源:RxSmartLockPasswordsFragment.java
示例2: onConnected
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
@Override
public void onConnected(@Nullable Bundle bundle) {
googleApi.requestCredentials(new ResultCallback<CredentialRequestResult>() {
@Override
public void onResult(@NonNull CredentialRequestResult result) {
if (result.getStatus().isSuccess()) {
onCredentialRetrieved(result.getCredential());
} else if (result.getStatus().getStatusCode() != CommonStatusCodes.SIGN_IN_REQUIRED && result.getStatus().hasResolution()) {
try {
result.getStatus().startResolutionForResult(LoginActivity.this, GoogleApiAdapter.RETRIEVE_CREDENTIALS);
} catch (IntentSender.SendIntentException e) {
Snackbar.make(vLoginForm, R.string.error_smartlock_failed, Snackbar.LENGTH_LONG);
}
}
}
});
}
开发者ID:Sefford,项目名称:BeAuthentic,代码行数:18,代码来源:LoginActivity.java
示例3: getCredentials
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
/**
* Begin the process of retrieving a {@link Credential} for the device user. This can have
* a few different results:
* 1) If the user has auto sign-in enabled and exactly one previously saved credential,
* {@link SmartLockListener#onCredentialRetrieved(Credential)} will be called and
* you can sign the user in immediately.
* 2) If the user has multiple saved credentials or one saved credential and has disabled
* auto sign-in, you will get the callback {@link SmartLockListener#onShouldShowCredentialPicker()}
* at which point you can choose to show the picker dialog to continue.
* 3) If the user has no saved credentials or cancels the operation, you will receive the
* {@link SmartLockListener#onCredentialRetrievalFailed()} callback.
*/
public void getCredentials() {
CredentialRequest request = buildCredentialRequest();
Auth.CredentialsApi.request(getFragment().getGoogleApiClient(), request)
.setResultCallback(new ResultCallback<CredentialRequestResult>() {
@Override
public void onResult(CredentialRequestResult result) {
if (result.getStatus().isSuccess()) {
// Single credential, auto sign-in
Credential credential = result.getCredential();
getListener().onCredentialRetrieved(credential);
} else if (result.getStatus().hasResolution() &&
result.getStatus().getStatusCode() != CommonStatusCodes.SIGN_IN_REQUIRED) {
// Multiple credentials or auto-sign in disabled. If the status
// code is SIGN_IN_REQUIRED then it is a hint credential, which we
// do not want at this point.
getListener().onShouldShowCredentialPicker();
} else {
// Could not retrieve credentials
getListener().onCredentialRetrievalFailed();
}
}
});
}
开发者ID:googlearchive,项目名称:easygoogle,代码行数:37,代码来源:SmartLock.java
示例4: showCredentialPicker
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
/**
* Show the dialog allowing the user to choose a Credential. This method shoud only be called
* after you receive the {@link SmartLockListener#onShouldShowCredentialPicker()} callback.
*/
public void showCredentialPicker() {
CredentialRequest request = buildCredentialRequest();
Activity activity = getFragment().getActivity();
int maskedCode = getFragment().maskRequestCode(RC_READ);
Auth.CredentialsApi.request(getFragment().getGoogleApiClient(), request)
.setResultCallback(new ResolvingResultCallbacks<CredentialRequestResult>(activity, maskedCode) {
@Override
public void onSuccess(CredentialRequestResult result) {
getListener().onCredentialRetrieved(result.getCredential());
}
@Override
public void onUnresolvableFailure(Status status) {
Log.e(TAG, "showCredentialPicker:onUnresolvableFailure:" + status);
}
});
}
开发者ID:googlearchive,项目名称:easygoogle,代码行数:23,代码来源:SmartLock.java
示例5: onResult
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
@Override
public void onResult(@NonNull CredentialRequestResult result) {
Status status = result.getStatus();
if (status.isSuccess()) {
// Auto sign-in success
handleCredential(result.getCredential());
return;
} else {
if (status.hasResolution()) {
try {
if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) {
startIntentSenderForResult(
status.getResolution().getIntentSender(),
RC_CREDENTIALS_READ);
return;
}
} catch (IntentSender.SendIntentException e) {
Log.e(TAG, "Failed to send Credentials intent.", e);
}
} else {
Log.e(TAG, "Status message:\n" + status.getStatusMessage());
}
}
startAuthMethodChoice();
}
开发者ID:firebase,项目名称:FirebaseUI-Android,代码行数:27,代码来源:SignInDelegate.java
示例6: onConnected
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
@Override
void onConnected(final SmartLock smartLock, final Activity activity) {
Log.v(TAG, "Requesting credentials from SmartLock");
getCredentialsApi().request(smartLock.getCredentialClient(), smartLock.newCredentialRequest()).setResultCallback(new ResultCallback<CredentialRequestResult>() {
@Override
public void onResult(CredentialRequestResult credentialRequestResult) {
final com.google.android.gms.common.api.Status status = credentialRequestResult.getStatus();
if (status.isSuccess()) {
final Credential credential = credentialRequestResult.getCredential();
Log.v(TAG, "Retrieved credentials for type " + credential.getAccountType());
smartLock.onCredentialsRetrieved(activity, credential);
} else {
smartLock.onCredentialRetrievalError(activity, status, SmartLock.SMART_LOCK_READ);
}
}
});
}
开发者ID:auth0,项目名称:Lock-SmartLock,代码行数:18,代码来源:RequestCredentialsTask.java
示例7: requestCredential
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
private void requestCredential() {
// disable auto sign in
if (mDisableAutoSignIn)
Auth.CredentialsApi.disableAutoSignIn(mCredentialsApiClient);
Auth.CredentialsApi.request(mCredentialsApiClient, mCredentialRequest).setResultCallback(
new ResultCallback<CredentialRequestResult>() {
@Override
public void onResult(@NonNull CredentialRequestResult credentialRequestResult) {
mCredentialsApiClient.disconnect();
mRequestSubject.onNext(credentialRequestResult);
mRequestSubject.onCompleted();
}
});
}
开发者ID:pchmn,项目名称:RxSocialAuth,代码行数:16,代码来源:RxSmartLockPasswordsFragment.java
示例8: shouldHandleRequestSuccess
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
@Test
public void shouldHandleRequestSuccess() throws Exception {
when(status.isSuccess()).thenReturn(true);
when(credentialRequestResult.getCredential()).thenReturn(credential);
task.onConnected(smartLock, activity);
verify(pendingResult).setResultCallback(captor.capture());
final ResultCallback<CredentialRequestResult> resultCallback = captor.getValue();
resultCallback.onResult(credentialRequestResult);
verify(smartLock).onCredentialsRetrieved(eq(activity), eq(credential));
}
开发者ID:auth0,项目名称:Lock-SmartLock,代码行数:11,代码来源:RequestCredentialsTaskTest.java
示例9: shouldHandleRequestFailure
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
@Test
public void shouldHandleRequestFailure() throws Exception {
when(status.isSuccess()).thenReturn(false);
task.onConnected(smartLock, activity);
verify(pendingResult).setResultCallback(captor.capture());
final ResultCallback<CredentialRequestResult> resultCallback = captor.getValue();
resultCallback.onResult(credentialRequestResult);
verify(smartLock).onCredentialRetrievalError(eq(activity), eq(status), eq(SmartLock.SMART_LOCK_READ));
}
开发者ID:auth0,项目名称:Lock-SmartLock,代码行数:10,代码来源:RequestCredentialsTaskTest.java
示例10: onResult
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
@Override
public void onResult(@NonNull CredentialRequestResult credentialRequestResult) {
Status status = credentialRequestResult.getStatus();
if (status.isSuccess()) {
onCredentialRetrieved(credentialRequestResult.getCredential());
} else {
resolveResult(status);
}
}
开发者ID:ShlMlkzdh,项目名称:RxSmartLock,代码行数:12,代码来源:RetrieveCredentialObservable.java
示例11: requestCredential
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
/**
* Request credential
*
* @return a PublishSubject<CredentialRequestResult>
*/
public PublishSubject<CredentialRequestResult> requestCredential() {
mRequestSubject = PublishSubject.create();
mRxSmartLockPasswordsFragment.requestCredential(mRequestSubject);
return mRequestSubject;
}
开发者ID:pchmn,项目名称:RxSocialAuth,代码行数:11,代码来源:RxSmartLockPasswords.java
示例12: requestCredentials
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
private void requestCredentials() {
mSignInButton.setEnabled(false);
mIsRequesting = true;
CredentialRequest request = new CredentialRequest.Builder()
.setPasswordLoginSupported(true)
.setAccountTypes(IdentityProviders.GOOGLE, IdentityProviders.TWITTER)
.build();
Auth.CredentialsApi.request(mGoogleApiClient, request).setResultCallback(
new ResultCallback<CredentialRequestResult>() {
@Override
public void onResult(CredentialRequestResult credentialRequestResult) {
// mIsRequesting = false;
Status status = credentialRequestResult.getStatus();
if (credentialRequestResult.getStatus().isSuccess()) {
// Successfully read the credential without any user interaction, this
// means there was only a single credential and the user has auto
// sign-in enabled.
Credential credential = credentialRequestResult.getCredential();
processRetrievedCredential(credential);
} else if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) {
// setFragment(null);
// This is most likely the case where the user has multiple saved
// credentials and needs to pick one.
resolveResult(status, RC_READ);
} else if (status.getStatusCode() == CommonStatusCodes.SIGN_IN_REQUIRED) {
// setFragment(null);
// This is most likely the case where the user does not currently
// have any saved credentials and thus needs to provide a username
// and password to sign in.
Log.d(TAG, "Sign in required");
mSignInButton.setEnabled(true);
} else {
Log.w(TAG, "Unrecognized status code: " + status.getStatusCode());
// setFragment(null);
mSignInButton.setEnabled(true);
}
}
}
);
}
开发者ID:obaro,项目名称:SmartLockSample,代码行数:43,代码来源:LoginActivity.java
示例13: requestCredentials
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
public void requestCredentials(ResultCallback<? super CredentialRequestResult> callback) {
Auth.CredentialsApi.request(client, new CredentialRequest.Builder()
.setPasswordLoginSupported(true)
.setAccountTypes(IdentityProviders.GOOGLE)
.build()).setResultCallback(callback);
}
开发者ID:Sefford,项目名称:BeAuthentic,代码行数:7,代码来源:GoogleApiAdapter.java
示例14: shouldSetResultCallback
import com.google.android.gms.auth.api.credentials.CredentialRequestResult; //导入依赖的package包/类
@Test
public void shouldSetResultCallback() throws Exception {
task.onConnected(smartLock, activity);
verify(pendingResult).setResultCallback(Matchers.<ResultCallback<CredentialRequestResult>>any());
}
开发者ID:auth0,项目名称:Lock-SmartLock,代码行数:6,代码来源:RequestCredentialsTaskTest.java
注:本文中的com.google.android.gms.auth.api.credentials.CredentialRequestResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论