0

I want to access information from my app what page user visiting using whatever browser he wants. Is it possible to do that on android, and if so how?

Xyzk
  • 1,332
  • 2
  • 21
  • 36

2 Answers2

2

not sure about android but in java you can do it in following way

HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
String ipAddress = request.getHeader("X-FORWARDED-FOR");
if (ipAddress == null) {
    ipAddress = request.getRemoteAddr();
}
System.out.println("ipAddress:" + ipAddress);

see original answer here

Community
  • 1
  • 1
ankit
  • 4,919
  • 7
  • 38
  • 63
  • Does it allow me to get information about other applications? As in my application will know what happens in browsers? – Xyzk Oct 19 '13 at 09:38
2

That would be a security vulnerability if it could be done. Your app would be able to spy on users credentials when posted, or track/hijack their sessions. I guess you can do this by building a proxy (like what HotSpotVPN does) and routing your phones traffic through the proxy. Therefore you can log visited pages in your proxy.

navit
  • 172
  • 6
  • But there are applications that block your access to certain websites basing on their IP access. – Xyzk Oct 19 '13 at 10:25
  • That would be [different](http://stackoverflow.com/questions/17398841/how-to-block-some-url-on-android-browser). anyhow I think you can try accessing your phone's browser history. [This](http://www.higherpass.com/Android/Tutorials/Accessing-Data-With-Android-Cursors/3/) is a sample and of course you need [this](http://stackoverflow.com/questions/2577084/android-read-browser-history) permission. – navit Oct 19 '13 at 10:53