use of com.amazonaws.services.cognitoidentityprovider.model.ResendConfirmationCodeResult in project aws-sdk-android by aws-amplify.
the class CognitoUser method resendConfirmationCode.
/**
* Request to resend registration confirmation code for a user, in current
* thread.
* <p>
* <b>Note:</b> This method will perform network operations. Calling this
* method in applications' main thread will cause Android to throw
* NetworkOnMainThreadException.
* </p>
*
* @param clientMetadata A map of custom key-value pairs that is passed to the lambda function for
* custom workflow.
* @param callback REQUIRED: {@link VerificationHandler} callback handler.
*/
public void resendConfirmationCode(final Map<String, String> clientMetadata, final VerificationHandler callback) {
if (callback == null) {
throw new CognitoParameterInvalidException("callback is null");
}
try {
final ResendConfirmationCodeResult resendConfirmationCodeResult = resendConfirmationCodeInternal(clientMetadata);
callback.onSuccess(new CognitoUserCodeDeliveryDetails(resendConfirmationCodeResult.getCodeDeliveryDetails()));
} catch (final Exception e) {
callback.onFailure(e);
}
}
use of com.amazonaws.services.cognitoidentityprovider.model.ResendConfirmationCodeResult in project aws-sdk-android by aws-amplify.
the class CognitoUser method resendConfirmationCodeInBackground.
/**
* Request to resend registration confirmation code for a user, in
* background.
*
* @param clientMetadata A map of custom key-value pairs that is passed to the lambda function for
* custom workflow.
* @param callback REQUIRED: {@link VerificationHandler} callback handler.
*/
public void resendConfirmationCodeInBackground(final Map<String, String> clientMetadata, final VerificationHandler callback) {
if (callback == null) {
throw new CognitoParameterInvalidException("callback is null");
}
new Thread(new Runnable() {
@Override
public void run() {
final Handler handler = new Handler(context.getMainLooper());
Runnable returnCallback;
try {
final ResendConfirmationCodeResult resendConfirmationCodeResult = resendConfirmationCodeInternal(clientMetadata);
returnCallback = new Runnable() {
@Override
public void run() {
callback.onSuccess(new CognitoUserCodeDeliveryDetails(resendConfirmationCodeResult.getCodeDeliveryDetails()));
}
};
} catch (final Exception e) {
returnCallback = new Runnable() {
@Override
public void run() {
callback.onFailure(e);
}
};
}
handler.post(returnCallback);
}
}).start();
}
Aggregations