I have android app that used webview to display Google App Engine web app. How to overwrite the default HTTP Error 504 Gateway timeout
encountered in my app?
HTTP Error 504 Gateway timeout
The server, while acting as a gateway or proxy, did not receive a
timely response from the upstream server it accessed in attempting
to complete the request.
I already override onReceivedError
which work when no internet connection available and other error.
webView.setWebViewClient(new WebViewClient(){
...
@SuppressLint("DefaultLocale")
@Override
public void onReceivedError(WebView view, int errorCode,String description, String failingUrl) {
try {
String template = streamToString(getAssets().open("html/error.html"));
String data = template.replaceAll("%DESCRIPTION%", description.toLowerCase())
.replaceAll("%WEBSITE_URL%", WEBSITE_URL);
view.loadDataWithBaseURL("file:///android_asset/html/", data, "text/html", "utf-8", null);
} catch (IOException e) {
e.printStackTrace();
}
}
});
onReceivedError
can't received HTTP errors only network error? Any workaround? How can android webview intercept HTTP errors?