Я работаю над реализацией Sumsub SDK и получаю ошибку с классом SNSErrorHandler.Android

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Я работаю над реализацией Sumsub SDK и получаю ошибку с классом SNSErrorHandler.

Сообщение Anonymous »

Я работаю над реализацией Sumsub SDK и получаю ошибку с классом SNSErrorHandler. Предлагается определить SNSAppActivity в файле Android Manifest.xml.
private void launchSdk(String accessToken, TokenExpirationHandler tokenUpdater) {//accessToken is coming from server (end pole) side.

List modules = Arrays.asList(new SNSProoface());
Context applicationContext = context.getApplicationContext();

SNSErrorHandler errorHandler = e -> {//Here I am getting error, It's saying to define SNSAppActivity in your Manifest.xml file
Timber.d("The SDK throws an exception. Exception: %s", e);

if (e instanceof SNSException.Api) {
Timber.d("Api exception. %s", ((SNSException.Api) e).getDescription());
} else if (e instanceof SNSException.Network) {
Timber.d(e, "Network exception.");
} else if (e instanceof SNSException.Unknown) {
Timber.d(e, "Unknown exception.");
}
Toast.makeText(applicationContext, "The SDK throws an exception. Exception: " + e, Toast.LENGTH_SHORT).show();
};

SNSStateChangedHandler stateChangedHandler = (previousState, currentState) -> {

Timber.d("The SDK state was changed: " + previousState + " -> " + currentState);

if (currentState instanceof SNSSDKState.Ready) {
Timber.d("SDK is ready");
parseStatus(currentState);
} else if (currentState instanceof SNSSDKState.Failed.Unauthorized) {
Timber.e(((SNSSDKState.Failed.Unauthorized) currentState).getException(), "Invalid token or a token can't be refreshed by the SDK. Please, check your token expiration handler");
parseStatus(currentState);

} else if (currentState instanceof SNSSDKState.Failed.Unknown) {
Timber.e(((SNSSDKState.Failed.Unknown) currentState).getException(), "Unknown error");
parseStatus(currentState);
} else if (currentState instanceof SNSSDKState.Initial) {
Timber.d("No verification steps are passed yet");
parseStatus(currentState);

} else if (currentState instanceof SNSSDKState.Incomplete) {
Timber.d("Some but not all verification steps are passed over");
parseStatus(currentState);
} else if (currentState instanceof SNSSDKState.Pending) {
Timber.d("Verification is in pending state");
parseStatus(currentState);

} else if (currentState instanceof SNSSDKState.FinallyRejected) {
Timber.d("Applicant has been finally rejected");
parseStatus(currentState);
} else if (currentState instanceof SNSSDKState.TemporarilyDeclined) {
Timber.d("Applicant has been declined temporarily");
parseStatus(currentState);

} else if (currentState instanceof SNSSDKState.Approved) {
Timber.d("Applicant has been approved");
parseStatus(currentState);
}

if (currentState instanceof SNSSDKState.ActionCompleted) {
SNSSDKState.ActionCompleted actionState = (SNSSDKState.ActionCompleted) currentState;
String actionId = actionState.getActionId();
FlowActionType type = actionState.getType();
String answer = actionState.getAnswer();
Map payload = actionState.getPayload();
}
};

SNSCompleteHandler completeHandler = (result, state) -> {
Timber.d("The SDK is finished. Result: " + result + " , State: " + state);
Toast.makeText(applicationContext, "The SDK is finished. Result: " + result + ", State: " + state, Toast.LENGTH_SHORT).show();

if (result instanceof SNSCompletionResult.SuccessTermination) {
Timber.d(result.toString());
} else if (result instanceof SNSCompletionResult.AbnormalTermination) {
Timber.d(((SNSCompletionResult.AbnormalTermination) result).getException());
}
};

SNSActionResultHandler actionResultHandler = (actionId, actionType, answer, allowContinuing) -> {
Timber.d("Action Result: actionId: " + actionId + ", answer: " + answer);
return SNSActionResult.Continue;
};

SNSEventHandler eventHandler = snsEvent -> {
if (snsEvent instanceof SNSEvent.SNSEventStepInitiated) {
Timber.d("onEvent: step initiated");
} else if (snsEvent instanceof SNSEvent.SNSEventStepCompleted) {
Timber.d("onEvent: step completed");
}
};

SNSSupportItem supportItem = new SNSSupportItem(
R.string.sns_support_title,
R.string.sns_support_subtitle,
SNSSupportItem.Type.Email, "support@company.com", null,
SNSIconHandler.SNSCommonIcons.MAIL.getImageName(), null);

try {

SNSMobileSDK.SDK snsSdk = new SNSMobileSDK.Builder(context)
.withBaseUrl(apiUrl)
.withAccessToken(accessToken, tokenUpdater)
.withDebug(true)
.withModules(modules)
.withCompleteHandler(completeHandler)
.withErrorHandler(errorHandler)
.withStateChangedHandler(stateChangedHandler)
.withActionResultHandler(actionResultHandler)
.withEventHandler(eventHandler)
.withSupportItems(Collections.singletonList(supportItem))
.withConf(new SNSInitConfig("support@gmail.com", "+910000000000", null))
.build();

snsSdk.launch();

} catch (Exception e) {
Timber.e(e);
}
showProgress(false);

}


Подробнее здесь: https://stackoverflow.com/questions/735 ... rorhandler
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»