开发者

capture android browser urls [closed]

开发者 https://www.devze.com 2023-01-29 14:06 出处:网络
It's difficult to tell what is being asked here. T开发者_开发问答his question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form.
It's difficult to tell what is being asked here. T开发者_开发问答his question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

how to capture url opened in android mobile browser

my requirement capture opend urls and maintain in list view

Thanks in advance

aSwan


after playing with some other apps that appear to be doing this very thing, I think this is roughly how they are doing it:

  1. create a background application that monitors running procs (check frequently, like every .2 seconds or something like that)
  2. if the browser is running, then request the current browser history list (this requires the com.android.browser.permission.READ_HISTORY_BOOKMARKS permission).
  3. If, for example, you are looking for malicious/offensive urls, then kill the browser immediately if you find anything in the history list and remove those offensive urls from the history (this requires the com.android.browser.permission.WRITE_HISTORY_BOOKMARKS and android.permission.KILL_BACKGROUND_PROCESSES permissions)
  4. If you did kill the browser, it will get restarted the next time the user selects the browser button/icon.

It's fairly inelegant, but I think it's the only way to do this right now. It also only works for the built-in browser (you'd have to specifically arrange to monitor other browser processes and histories if you wanted to work for them as well.)


This is essentially not possible with the stock browser on an android consumer device for security and privacy reasons.

You may be able to use netstat (or look in /proc/net/tcp) to see the IP addresses and port numbers of currently active connections, but this won't tell you the file being accessed or even in many cases the specific site as mapping between IP and host names is not 1:1. And it might happen when you aren't looking.

On a rooted phone you can extract the browser's history database.

You can write your own browser leveraging the same underlying webkit engine, or even the stock browsers sources, while also providing some kind of monitoring or history api. But the user has to decide to use that instead of the stock browser.

0

精彩评论

暂无评论...
验证码 换一张
取 消