webviewclient

Android WebViewClient url redirection (Android URL loading system)

余生长醉 提交于 2019-12-06 07:28:04
问题 I was trying intercept webview request using: ShouldInterceptRequest , inside it I used HttpUrlConnection to fetch data from server, I set it to follow the redirection, which is transparent to webviewclient. This means when I return WebResponseResource("", "", data_inputstream), webview maynot know the target host was changed. How can I tell the webview this happened? ourBrowser.setWebViewClient(new WebViewClient() { @Override public WebResourceResponse shouldInterceptRequest(WebView view,

Upload photo from gallery or take from camera in Webview

蓝咒 提交于 2019-12-06 06:03:35
My application is webbased and need to upload photos, website have a file input button, i made it work with this wv = new WebView(this); wv.setWebViewClient(new WebViewClient()); wv.getSettings().setJavaScriptEnabled(true); wv.getSettings().setAllowFileAccess(true); wv.setWebChromeClient(new WebChromeClient() { public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture){ mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("image/*"); MainActivity.this.startActivityForResult( Intent

Android WebViewClient onReceivedError is not called for a 404 error

坚强是说给别人听的谎言 提交于 2019-12-05 20:02:23
问题 hi In a list view i have an webview which should load a image file from the server,when there is no image present i need a dummy image .I tried holder.image.setWebViewClient(new WebViewClient() { @Override public void onReceivedError( WebView view, int errorCode, String description, String failingUrl) { System.out.println("description error" + description); view.setVisibility( View.GONE ); } @Override public void onPageFinished(WebView view, String url) { view.setVisibility( View.VISIBLE ); }

Android WebView get raw cookie information

亡梦爱人 提交于 2019-12-05 19:36:26
I try to get cookie information with CookieManager in Android WebView. However, all it does is providing a key value pair of cookies, no additional information. I also tried this post and use connection.getHeaderFields.get("Set-Cookie"); to get all cookies received from server. But from what I can tell, I don't see all cookies that I am supposed to receive from server. This can also be found by some cookies in CookieManger receive a new value but not show in Set-Cookie field. Ideally, I would like to intercept every response and inspect their cookies with all information from server such as

Log <GATE-M>DEV_ACTION_COMPLETED</GATE-M> seems to delay execution on Android

假装没事ソ 提交于 2019-12-05 07:23:30
I've recently noticed that my app has the occasional LAG. and by LAG I mean it can take up to 40 seconds, depends if I use Wifi or mobile data... I load a page url, and then load js for execution: webView = (WebView) view.findViewById(R.id.WebView); webView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { logDebug("Loading URL: " + url); super.onPageStarted(view, url, favicon); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { return WrappingClass.this.shouldOverrideUrlLoading(view, url); }

WebViewClient returning “Couldn't establish a secure connection.” upon recreating the fragment

谁说我不能喝 提交于 2019-12-05 03:48:15
Our application has tabs and one of the fragments can contain a webviewclient. Users are now reporting an issue where the webviewclient is unable to load the page. We've confirmed that the server is up and running, we've also identified that the issue happens in v4.3 and all earlier versions. We have also confirmed that it works fine in v5.0; right now we've not been able to test whether it works in 4.4 or not (I guess that information only helps if someone knows of a change that occurred in 4.4 and newer that would cause something to fail in all earlier versions). So the actual problem is we

System Crash When Overriding shouldInterceptRequest in WebViewClient

喜你入骨 提交于 2019-12-04 22:34:11
Goal: Override all requests made by a WebView and make the request myself (eventually set up a proxy). Code: @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { if (url == null || url.trim().equals("")) return null; final DefaultHttpClient httpClient = new DefaultHttpClient(); httpClient.getConnectionManager().closeExpiredConnections(); final HttpUriRequest httpRequest = new HttpGet(url); try { final HttpResponse response = httpClient.execute(httpRequest); final Header[] headers = response.getHeaders(CONTENT_TYPE); String mimeType = ""; String encoding = "";

Android WebViewClient url redirection (Android URL loading system)

若如初见. 提交于 2019-12-04 11:45:47
I was trying intercept webview request using: ShouldInterceptRequest , inside it I used HttpUrlConnection to fetch data from server, I set it to follow the redirection, which is transparent to webviewclient. This means when I return WebResponseResource("", "", data_inputstream), webview maynot know the target host was changed. How can I tell the webview this happened? ourBrowser.setWebViewClient(new WebViewClient() { @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { ..... //some code omitted here HttpURLConnection conn = null; try { conn =

Android WebViewClient onReceivedError is not called for a 404 error

北战南征 提交于 2019-12-04 02:20:12
hi In a list view i have an webview which should load a image file from the server,when there is no image present i need a dummy image .I tried holder.image.setWebViewClient(new WebViewClient() { @Override public void onReceivedError( WebView view, int errorCode, String description, String failingUrl) { System.out.println("description error" + description); view.setVisibility( View.GONE ); } @Override public void onPageFinished(WebView view, String url) { view.setVisibility( View.VISIBLE ); } }); I have this webview with an dummy image in a FrameLayout, onPageFinished listener is called after

Android Ask for permission to use location within webview

怎甘沉沦 提交于 2019-12-02 22:02:00
问题 I have an application that uses a webview and inside the webview is a map, I have got it working to the user automatically find the users location with the following code: Manifest file Permissions: <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_GPS" /> <uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" /> <uses-permission android:name="android.permission.ACCESS_LOCATION" /> <uses-permission android