안드로이드 kitkat 버전에서 http error code 잡는 법 아시는 분 있나요?
조회수 2585회
프로젝트에서 http status code로 상황을 달리해줘야 하는데요. 아래 소스 코드와 같은 에러 처리는 이미 하였는데요. 제가 멀 잘못 한 건지 킷캣버전에서는 안잡히네요. 아시는 분 있을까요?
@SuppressWarnings("deprecation")
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
if (errorCode == 403 || errorCode == 401) {
new CommonDialog(context, "onReceivedError deprecated", String.valueOf(errorCode)).show();
}
Log.e(TAG, "onReceivedError deprecated" + errorCode);
}
@RequiresApi(Build.VERSION_CODES.M)
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
int errorCode = error.getErrorCode();
if (errorCode == 403 || errorCode == 401) {
new CommonDialog(context, "onReceivedError M", String.valueOf(errorCode)).show();
}
Log.e(TAG, "onReceivedError M" + errorCode);
}
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
int statusCode = errorResponse.getStatusCode();
if (statusCode == 401 || statusCode == 403) {
new CommonDialog(context, "onReceivedHttpError LOLLIPOP", String.valueOf(statusCode)).show();
}
Log.e(TAG, "onReceivedHttpError" + statusCode);
}```
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력