I am trying to use setRecommendedGlobalProxy for android. You can find the documentation here.
I understand that it takes inputs, host, port and list of URLs to block, however when I used it, all network on my device stopped working. So I did end up breaking my HTTP which is not what I want.
I want to be able to block specific websites (inappropriate for school environment).
Do I have to setup a proxy server? But the documentation states that it is network independent.
I already have device owner. Please note, I cannot use any kind of root method.
Purpose of using the proxy: I want to block inappropriate content from devices, when used in school.
Yes, you will need to setup a proxy server.
The setRecommendedGlobalProxy() function requires a ProxyInfo parameter which is used to provide the proxy host, port, etc... you plan to proxy all http/https traffic to. The documentation states that the proxy is network independent which only means that no matter what wifi/cellular network the device is connected to, http/https traffic will always be proxified.
Set the global proxy to a proxy you know is working and your http shouldn't break anymore. Then, go to your proxy and block the unwanted websites.
Here's an example in case you need it.
Note: I realize this is an old question but figured I'd respond for the sake of anyone else who comes along.