FORUMS
Remove All Ads from XDA

AdBlock (Advertisements Blocking) using hosts file

85 posts
Thanks Meter: 11
 
By MomirPeh, Member on 17th February 2011, 10:50 PM
Post Reply Email Thread
I found a most effective way of locking advertisements on free apps and generally in Android. Since Android is basically a linux OS then we can use hosts file to redirect known advertisement hosts or domains to localhost (local loopback) address (127.0.0.1). Advantage of this approach is that not a single byte is transferred through your data connection when an advertisement is to be retrieved from its server. Thus, it's the fastest way also.

Credits for this method is not mine at all. I used a post from another XDA forum section made by user pinkolin.

Firstly, get Android SDK, since we'll be using the "adb" tool to upload the customized hosts file to your Android device.
Open Command Prompt and change dir to the dir you installed SDK to.
cd to "platform-tools" folder (adb.exe is there).

Next, get the latest hosts file here (right-click and "Save Link As" to the folder where adb.exe is):
http://www.mvps.org/winhelp2002/hosts.txt
Note: pinkolin's hosts file in his post was outdated so i used above source instead. This file is updated on January-13-2011.

On the phone, make sure you enabled USB Debugging (Settings > Applications > Development > Check USB Debugging).

Connect your phone to your PC.

Now, go back to Command Prompt and type the following commands (I recommend using copy-paste for them)
Code:
adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system 
adb push hosts.txt /etc/hosts
adb shell mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system
Now, disconnect the phone and reboot it and You're DONE!!! No more ADS!!!
The Following 2 Users Say Thank You to MomirPeh For This Useful Post: [ View ] Gift MomirPeh Ad-Free
18th February 2011, 12:44 AM |#2  
skribbler86's Avatar
Senior Member
Thanks Meter: 6
 
More
Adfree app in the market does the same job but I might try this way now

Sent from my GT540 using Tapatalk
21st February 2011, 02:47 AM |#3  
Member
Flag A pub somewhere
Thanks Meter: 1
 
More
I use Adfree too but in the emulator to get the latest hosts, then cat > to phone.
5th March 2011, 03:55 PM |#4  
lackonne's Avatar
Senior Member
Flag Surabaya
Thanks Meter: 15
 
More
that is what i want...THANK YOU!!
7th March 2011, 09:48 PM |#5  
Junior Member
Flag Zagreb
Thanks Meter: 3
 
More
thanks for this!!
13th March 2011, 05:54 PM |#6  
Junior Member
Thanks Meter: 2
 
More
Thanks a lot! Simple and effective.
21st July 2019, 08:41 AM |#7  
Junior Member
Thanks Meter: 0
 
More
Rebel 4 boot
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes