本文整理了Java中com.google.android.gms.tasks.Task.getException()
方法的一些代码示例,展示了Task.getException()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.getException()
方法的具体详情如下:
包路径:com.google.android.gms.tasks.Task
类名称:Task
方法名:getException
暂无
代码示例来源:origin: googlemaps/android-samples
@Override
public void onComplete(@NonNull Task<Location> task) {
if (task.isSuccessful()) {
// Set the map's camera position to the current location of the device.
mLastKnownLocation = task.getResult();
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(
new LatLng(mLastKnownLocation.getLatitude(),
mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));
} else {
Log.d(TAG, "Current location is null. Using defaults.");
Log.e(TAG, "Exception: %s", task.getException());
mMap.moveCamera(CameraUpdateFactory
.newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));
mMap.getUiSettings().setMyLocationButtonEnabled(false);
}
}
});
代码示例来源:origin: chat-sdk/chat-sdk-android
if(task.getException() != null) {
Timber.d(task.getException());
代码示例来源:origin: chat-sdk/chat-sdk-android
public Completable signInWithCredential (final Activity activity, final AuthCredential credential) {
return Completable.create(e -> FirebaseAuth.getInstance().signInWithCredential(credential)
.addOnCompleteListener(activity, task -> {
if (task.isSuccessful() && task.isComplete()) {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
FirebaseAuthenticationHandler handler = (FirebaseAuthenticationHandler) ChatSDK.auth();
handler.authenticateWithUser(user).subscribe(e::onComplete, e::onError);
}
else {
e.onError(task.getException());
}
}));
}
代码示例来源:origin: chat-sdk/chat-sdk-android
public Completable sendPasswordResetMail(final String email) {
return Completable.create(
emitter->{
OnCompleteListener<Void> resultHandler = task->{
if (task.isSuccessful()) {
emitter.onComplete();
} else {
emitter.onError(getFirebaseError(DatabaseError.fromException(task.getException())));
}
};
FirebaseAuth.getInstance().sendPasswordResetEmail(email).addOnCompleteListener(resultHandler);
}).subscribeOn(Schedulers.single());
}
代码示例来源:origin: googlemaps/android-samples
Log.e(TAG, "Exception: %s", task.getException());
代码示例来源:origin: chat-sdk/chat-sdk-android
@Override
public Completable changePassword(String email, String oldPassword, final String newPassword) {
return Completable.create(
emitter->{
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
OnCompleteListener<Void> resultHandler = task->{
if (task.isSuccessful()) {
emitter.onComplete();
} else {
emitter.onError(getFirebaseError(DatabaseError.fromException(task.getException())));
}
};
user.updatePassword(newPassword).addOnCompleteListener(resultHandler);
})
.subscribeOn(Schedulers.single());
}
代码示例来源:origin: GDGAhmedabad/Learning-Resources
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(!task.isSuccessful()) {
mPrgrsbrMain.setVisibility(View.GONE);
Log.w(LOG_TAG, "signInWithFirebase", task.getException());
Snackbar.make(mCrdntrlyot, "Authentication failed.\n" + task.getException().getMessage(),
Snackbar.LENGTH_LONG).show();
} else
successLoginGetData(task);
}
});
代码示例来源:origin: UdacityAndroidBasicsScholarship/wmn-safety
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Log.v("Write Data", "New User Data stored successfully");
onSignInSuccess();
} else {
Log.w("FireBase Error", task.getException().toString());
Toast.makeText(SigninActivity.this, task.getException().toString(),
Toast.LENGTH_SHORT).show();
}
}
});
代码示例来源:origin: firebase/snippets-android
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// User is now successfully reauthenticated
} else {
Log.e(TAG, "Error reauthenticating", task.getException());
}
}
});
代码示例来源:origin: mongodb/stitch-examples
@Override
public void onComplete(@NonNull final Task<StitchUser> task) {
if (task.isSuccessful()) {
initTodoView();
} else {
Log.e(TAG, "Error logging in with Google", task.getException());
}
}
});
代码示例来源:origin: GDGAhmedabad/Learning-Resources
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
LogManager.printLog(LOGTYPE_DEBUG, "signInWithCredential:onComplete:" + task.isSuccessful());
if (!task.isSuccessful()) {
mPrgrsbrMain.setVisibility(View.GONE);
Log.w(LOG_TAG, "signInWithCredential", task.getException());
Snackbar.make(mCrdntrlyot, "Authentication failed.\n" + task.getException().getMessage(),
Snackbar.LENGTH_LONG).show();
} else
successLoginGetData(task);
}
});
代码示例来源:origin: GDGAhmedabad/Learning-Resources
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
LogManager.printLog(LOGTYPE_DEBUG, "signInWithCredential:onComplete:" + task.isSuccessful());
if (!task.isSuccessful()) {
mPrgrsbrMain.setVisibility(View.GONE);
Log.w(LOG_TAG, "signInWithCredential", task.getException());
Snackbar.make(mCrdntrlyot, "Authentication failed.\n" + task.getException().getMessage(),
Snackbar.LENGTH_LONG).show();
} else
successLoginGetData(task);
}
});
代码示例来源:origin: IBM/android-kubernetes-blockchain
@Override
public void onComplete(@NonNull Task<Boolean> task) {
if (task.isSuccessful() && task.getResult()) {
Log.d(TAG, "Step Listener for steps was removed.");
} else {
Log.e(TAG, "Step Listener for steps was not removed.", task.getException());
}
}
}
代码示例来源:origin: thinkmobiles/Android-MVP-vs-MVVM-Samples
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
final Exception exception = task.getException();
printStackTrace(exception);
if (registerCallback != null){
registerCallback.onComplete(task.isSuccessful(), exception != null ? exception.getMessage() : "");
}
}
});
代码示例来源:origin: thinkmobiles/Android-MVP-vs-MVVM-Samples
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
final Exception exception = task.getException();
printStackTrace(exception);
if (signInCallback != null) {
signInCallback.onComplete(task.isSuccessful(), exception != null ? exception.getMessage() : "");
}
}
});
代码示例来源:origin: thinkmobiles/Android-MVP-vs-MVVM-Samples
@Override
public void onComplete(@NonNull Task<Void> task) {
final Exception exception = task.getException();
printStackTrace(exception);
if (callback != null) {
callback.onResult(task.isSuccessful(), exception != null ? exception.getMessage() : "");
}
}
});
代码示例来源:origin: UdacityAndroidBasicsScholarship/wmn-safety
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(getApplicationContext(), "Password updated successfully", Toast.LENGTH_SHORT).show();
} else {
Log.e("Password Update", task.getException() + "");
Toast.makeText(getApplicationContext(), "Password update failed", Toast.LENGTH_SHORT).show();
}
}
});
代码示例来源:origin: UdacityAndroidBasicsScholarship/wmn-safety
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
mHelpers.hideProgressDialog();
if (task.isSuccessful()) {
mHelpers.showToast(getString(R.string.login_success));
onSignInSuccess();
} else {
Log.w("Sign in failed", task.getException().toString());
mHelpers.showAlertDialog(getString(R.string.error_message), task.getException().getMessage()).show();
}
}
});
代码示例来源:origin: Countly/countly-sdk-android
@Override
public void onComplete(@NonNull Task<InstanceIdResult> task) {
if (!task.isSuccessful()) {
Log.w(TAG, "getInstanceId failed", task.getException());
return;
}
// Get new Instance ID token
String token = task.getResult().getToken();
CountlyPush.onTokenRefresh(token);
}
});
代码示例来源:origin: chat-sdk/chat-sdk-android
emitter.onSuccess(task.getResult().getUser());
} else {
emitter.onError(task.getException());
内容来源于网络,如有侵权,请联系作者删除!