我正在研究 Sumsub SDK 实现,遇到 SNSErrorHandler 类错误。意思是在Android Manifest.xml文件中定义SNSAppActivity。
private void launchSdk(String accessToken, TokenExpirationHandler tokenUpdater) {//accessToken is coming from server (end pole) side.
List<SNSModule> 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<String, Object> 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, "[email protected]", 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("[email protected]", "+910000000000", null))
.build();
snsSdk.launch();
} catch (Exception e) {
Timber.e(e);
}
showProgress(false);
}
几年后我遇到了类似的问题,你解决了吗?我相信你做到了,所以你能帮我解决这个问题吗?