As we all know we can block any websites from our computer using windows host files. If we are using wireless router, then also we can blog website using router, so we can prevent our children accessing porn sites from their device. But this is limited to wifi connection only, what if they activate data plan on their mobile and start using such sites? Well, you can edit & modify android host file to block specific websites. You can monitor your child’s activity on android, to check which sites they browsing most often. If you think the sites they are browsing are unsafe for your children, you can block that site using your computer by using following tutorial.
Related : Block Ads on Android
Please note that the process requires rooted android device. So you must root your device before you start the procedure. If you don’t know how to root your android device, just comment your android device’s model number, name and specification if any. We will write tutorial on how to root your device here.
How to Modify Hosts File on Android:
This is the easiest way to edit hosts file on your android device, you can use Android Debug Bridge(ADB). So setup & install the Android Debug Bridge Utility.Once you have done, navigate into the folder where ADB is located and type cmd into the location bar, which will open a command prompt in the current folder.
Once command prompt window opens, type “adb devices” without quotes to see what device is attached to your computer.
Now you will need to get location of Android Hosts file and download it, so that you can modify it and add the sites that you want to get blocked on your android smartphone.Type the following command on command prompt.
adb pull /system/etc/hosts F:\hosts
What the command do is, it will copy the android hosts file from system>etc>hosts and will copy it on your computer’s F drive.
Right click on the hosts file copied in your F drive and open it with notepad. Once it opened, you will see the notepad file as shown in image with some entries. Here you will can add as many sites as you want. Suppose you want to block yahoo.com site, you will need to add 127.0.0.1 yahoo.com at the bottom. if you want to block thepiratebay , add another entry 127.0.0.1 thepiratebay.sx this way, when user types thepiratebay.sx in android device, it will be redirected to local host and will not let user to browse that added site in that list.
You have modified the hosts file from your local drive of computer. Now you will have to overwrite the hosts file on your android system>etc>hosts. So open command prompt and type the following command to replace the old hosts file with modified host file.
adb push F:\hosts /system/etc/
So it will transfer the file from F drive of your computer and replace the old hosts file with modified one.
See, we have blocked Facebook.com from hosts file, so whenever user will type facebook.com from the browser, it will not open.
You can also use Hosts editor android app, which is available free on Google Play Store, if you don’t want to edit it through your computer. You can easily modify your android’s hosts file using that hosts editor android app.