How would I write an app to block specific webisites on Android?
I'm considering writing an internet filter app for Android which would allow parents to block objectionable web sites on their children's phones. I'm assuming this would also be useful on GoogleTV when it come开发者_高级运维s out. How would I even start? Is it possible to block access to specific sites without requiring the user to root their phone?
I'm guessing I could do it with iptables, but that would probably require a rooted phone.
Edit:
If the phone was rooted, how would one go about doing this? Are ip tables the way to go or is there a better way?
Sorry, an application can't do this.
Given you can find isAllowed(Url) you can use WebView to load a new page. Although as I write it, you might want a more powerful browser than WebView, http://androidcommunity.com/forums/f4/how-open-a-new-screen-to-display-a-web-page-141/ might be helpful.
You can set an intent-filter for some url (using http scheme). By this way, if user browser on an identified url, your app will be launched instead of the webpage.
more details here: http://developer.android.com/guide/topics/intents/intents-filters.html#ifs and here: http://developer.android.com/guide/topics/manifest/data-element.html
Regards, Patrick
精彩评论