I need to display a web page in my Android app which is looking for a referer to bypass the security. I\'m new to Android so I know how to display the web page in a web view
You will need to use Intent Filters to capture and modify WebView requests.
Assuming that you need to specify doamin.com/page.html as referrer
In newer APIs you can specify headers in loadUrl itself.
For which API-level do you need that function?
Since API Level 8 there is a second loadUrl
function:
public void loadUrl (String url, Map<String, String> extraHeaders)
With the extraHeaders
you should be able to send a referrer.
Here is a complete working example:
String url = "http://www.targetserver.tld/";
Map<String, String> extraHeaders = new HashMap<String, String>();
extraHeaders.put("Referer", "http://www.referer.tld/login.html");
WebView wv;
wv = (WebView) findViewById(R.id.webview);
wv.loadUrl(url, extraHeaders);