AdFree is a fantastic program created by XDA user delta_foxtrot2 (see this thread in the G1 forum) to facilitate using your hosts file to block ad servers. This makes it extremely easy. Of course you will need root access!
Unfortunately I found some ads still weren't blocked and the last update to the AdFree hosts file happened 2010-02-27. So I decided to update the hosts file myself. I merged the hosts files from adfree/mvps/yoyo and added a bunch of mobile ad providers I've found myself. The list is free of duplicates and comments, so as to keep it as small as possible (it still amounts to about 635 kB).
To install this hosts file, you still need root access obviously:
download the zip
unpack it to the directory where adb.exe is located (if you don't know what adb is or how to get it running, please use the search)
open a command prompt
Code:
adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
adb push hosts.for.mobile.txt /etc/hosts
adb shell mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system
You might need to restart your phone. Also clearing the Android browser cache will apparently help in getting rid of already cached ads (worked for me, ymmv).
As for ethical discussions on blocking ads for free apps, blah. I don't so much have a problem with ads, as I do with the personal data that gets send to the ad providers. I'm talking about location data and whatever else they might want to know about my device and what I'm running ("analytics" is a fancy name for "we want to find out as much about you as we possibly can get away with").
Anyway.. use it, don't use it, up to you.
Last updated
15-4-2010 23:23 (20808 hosts blocked)
.
Thanks a bunch!
Thanks for the updated hosts. So should we even bother with the program, especially if it doesn't get updated hardly at all?
You're welcome!
If you push my hosts file, you don't need the AdFree app, but I wanted to acknowledge his work and give people a simpler alternative to using adb.
Best choice right now is my hosts file as it's simply more comprehensive.
Sent from my HTC Hero using the XDA mobile application powered by Tapatalk
phaelox said:
You're welcome!
If you push my hosts file, you don't need the AdFree app, but I wanted to acknowledge his work and give people a simpler alternative to using adb.
Best choice right now is my hosts file as it's simply more comprehensive.
Sent from my HTC Hero using the XDA mobile application powered by Tapatalk
Click to expand...
Click to collapse
Understood. Yeah, it was a great start/beginning to blocking ads, but no updates. Thanks again.
Thanks! I've been looking for something like this for awhile. Real quick question: is getting "Data connectivity errors" in browser normal with this? It didn't start till I pushed this on my phone.
tmayne said:
Real quick question: is getting "Data connectivity errors" in browser normal with this? It didn't start till I pushed this on my phone.
Click to expand...
Click to collapse
Short answer: Yes.
Long answer:
You may know this, but I'll explain anyway. The way this works is as follows. The loopback address for any network interface is 127.0.0.1 -- this is the address for the device, but only from the device itself, it loops back on itself. We don't want to waste bandwidth with ads, or have ad providers collect all sorts of data on us, so we don't want to connect to them. Any FQDN -Fully Qualified Domain Name- (for example: analytics.admob.com) needs to be converted into an IP address to be able to connect to it. Here's where the 'hosts' file comes in. It's a simple text file with a record on each line that says redirect 'hostname' to 'ip-address'. So we put a line in that reads '127.0.0.1 analytics.admob.com'. This tells our device that any connection made to 'analytics.admob.com' needs to be redirected to '127.0.0.1', which is your device. Basically a dead-end, as you are not running their webserver serving ads on your device, so this results in a data connection error.
Now, usually you will surf to a site that loads images (advertisements) from a server that is listed in this hosts file, and as a result the ads will not load. That shouldn't popup any error windows. But if you try to visit http://analytics.admob.com in your browser, then yes, you will see an error.
If the latter happens with a site you do wish to visit, just open the hosts file in a text editor (one that supports UNIX-style line ends) and remove the line in question, or put a '#' in front of the line to comment it out.
Hope that made it clearer.
Yeah it did. No worries though since it seems that after pressing "Ok" everything works fine! Small trade off for blocked ads! Thanks!
Thanks for this How-TO!
So basicaly that mean we can restrict acces to certain websites from our phone?
eg: adding this line
Code:
127.0.0.1 forum.xda-developers.com
and I'll no longer be able to browse XDA from my phone?
Keep writing such How-To, like this one and the one to sign update.zip, I found this interessant and usefull
tmayne said:
Yeah it did. No worries though since it seems that after pressing "Ok" everything works fine! Small trade off for blocked ads! Thanks!
Click to expand...
Click to collapse
You're welcome, glad I could help.
carbonyle said:
Thanks for this How-TO!
So basicaly that mean we can restrict acces to certain websites from our phone?
eg: adding this line
Code:
127.0.0.1 forum.xda-developers.com
and I'll no longer be able to browse XDA from my phone?
Keep writing such How-To, like this one and the one to sign update.zip, I found this interessant and usefull
Click to expand...
Click to collapse
Cheers. And yes, that's exactly right. Just remember the hosts file takes FQDN's, so you can block a domain (or subdomain) this way, but not a directory or page on a domain. Also, blocking a domain does not also block its subdomains.
PS. this method of using the hosts file is not unique to your android phone, it works on most operating systems on PC as well. See this Wikipedia entry for more info.
what about non rooted phones? I just got myself a htc desire, I'm happy with it but would be happier if I wouldn't be required to see all those ads.
Unfortunately root is required to remount /system as writable to be able to overwrite the hosts file.
Without root you could use another free app found in Market called "AdBlock", which functions as a localhost proxy. Just set localhost as proxy in APN/wifi settings. It doesn't come with a prefilled list of keywords to block though, but it works on a URL level, not FQDN, so you can specify a url or part of it to block.
Just one more quick concern about the Data Connectivity issues: Certain areas of my university require a redirect page login in order to connect to wifi. However, it seems that at certain locations, I get the Data Connectivity error pop up repeatedly and my phone never makes it to the redirect page.
Actually it seems my phone only likes the wifi in my dorm. As stepping outside (to a library or classroom) and attempting to connect to the same wifi produces the error.
Is this an issue with the hosts file or with the phone itself??
Thanks!
If you DO see the wifi redirect page at SOME locations, then the hosts file is not blocking it (wouldn't make sense as it's likely an intranet page anyway). Sounds like wifi reception is unstable on your phone.
This is getting off-topic, but..... Have you already updated your radio? (the part of the ROM that handles everything related to GSM/3G/WiFi/Bluetooth connections). If not, here for the latest radio update.zip - flash through recovery.
phaelox said:
If you DO see the wifi redirect page at SOME locations, then the hosts file is not blocking it (wouldn't make sense as it's likely an intranet page anyway). Sounds like wifi reception is unstable on your phone.
This is getting off-topic, but..... Have you already updated your radio? (the part of the ROM that handles everything related to GSM/3G/WiFi/Bluetooth connections). If not, or the latest radio update.zip - flash through recovery.
Click to expand...
Click to collapse
I should note that I'm using a Motorola Cliq...Handler 1.5 ROM. There is a radio update available for the Motorola Cliq (I'm currently using 1.3.18 and 1.4.8 has been released) but there are some apk incompatibilities with it (particularly Swype which I love...since it's in closed beta right now, there are no accessible updates for it unfortunately).
Since I bought my phone off of ebay, I can't send it back for a new one. The essential things work but it is a bit frustrating that it has some problems.
tmayne said:
I should note that I'm using a Motorola Cliq...Handler 1.5 ROM. There is a radio update available for the Motorola Cliq (I'm currently using 1.3.18 and 1.4.8 has been released) but there are some apk incompatibilities with it (particularly Swype which I love...since it's in closed beta right now, there are no accessible updates for it unfortunately).
Since I bought my phone off of ebay, I can't send it back for a new one. The essential things work but it is a bit frustrating that it has some problems.
Click to expand...
Click to collapse
I'm pretty sure that updating radio won't affect other softwares since "radio" is *just* the piece of code that can handle GSM/Wifi/BT/3G, ... signals
I'll always keep an open mind, but from what I know, I'm with carbonyle on this.
Back on topic:
if you come across an app that still displays ad, regardless of my hosts file, please reply in this topic with the app/version (and a logcat output would be nice if you know how) and I'll see if I can find the ad provider domain and update the hosts file.
I'm confused... This is for blocking apps adds???
:No-Frost: said:
I'm confused... This is for blocking apps adds???
Click to expand...
Click to collapse
Yes it is. See it like a firewall wich blocks mobile ads. Because the app wont recieve any response from the ad url it tries to reach, it'll simply not display the ad (like when you use the app without wifi or data connextion on)
Wooooooo thanks... worked like a charm in glympse shazam and others =D...
PS: Air Control still have adds... Mmm how can we know what's the host for the add in the apps so we can contribute into blocking them???
Originally I was on stock 2.1 rooted with the official update and ad-free android was working fine. The other day I used kies mini to get the official 2.2 froyo update as per tmobile's instructions, then I re-rooted with super one click. All my root only apps are working fine and able to get SU permissions, including ad-free android. I run ad-free android like I always have and it just doesn't block any ads at all, neither in apps or on the web.
I've search the forums for days but can't make sense of any of the threads that seem related.
Hoping someone can put me on the right track.
So far I have tried:
1. Reverting, and redownloading/reapplying hosts. (Within ad-free android.)
2. Uninstalling, rebooting, and reinstalling.
And to summarize my state, I'm stock 2.2 with root and the only root apps I have are wifi tether, barnacle and ad-free android and they all report getting superuser permissions successfully.
It was doing this for me too. I would check for host updates but it would say they are the latest and still would not.block ads. A reinstall, update of hosts file and reboot worked for me though.
So I have to play devils advocate but why block the ad's. I realize that they can be annoying but after listening to droid cast and following some of the app dev's on twitter I can say that I no longer use them.
Biggest reason to not use an ad blocker is to support your dev's otherwise they go to the apple side to make more money.
But anyway like the other user said make sure you have the most up todate files. then It will work.
also tried:
3: settings/manage apps/clear data
-Uninstall, reboot, reinstall, redownload/apply hosts
-reboot, still ads
hazard99 said:
So I have to play devils advocate but why block the ad's. I realize that they can be annoying but after listening to droid cast and following some of the app dev's on twitter I can say that I no longer use them.
Biggest reason to not use an ad blocker is to support your dev's otherwise they go to the apple side to make more money.
But anyway like the other user said make sure you have the most up todate files. then It will work.
Click to expand...
Click to collapse
I want to block ads on websites primarily, and also block ads in angry birds, which I've already paid for on iPod touch.
But ya I tried all that and it still doesn't block ads. It's very weird. It says it's all set and up to date, but no ads anywhere are blocked.
hazard99 said:
So I have to play devils advocate but why block the ad's. I realize that they can be annoying but after listening to droid cast and following some of the app dev's on twitter I can say that I no longer use them.
Biggest reason to not use an ad blocker is to support your dev's otherwise they go to the apple side to make more money.
But anyway like the other user said make sure you have the most up todate files. then It will work.
Click to expand...
Click to collapse
Yep, I only care about ads on websites that are misplaced and horribly annoying (flash ad's come to mind). I don't mind having ad's in apps/games that are free.
I use adblock + flashblock on Firefox because of my reasons above, however I do let ad's on certain sites load to support the site owner (xda and teamwhiskey sites for example). I don't mind ad's like google adsense which aren't really annoying, but some sites just overkill on the ad's and force me to block them.
I think I figured it out, my /system directory was 100% full.
I used root uninstaller (free from market, by "android text") to remove telenav gps then reinstalled ad-free and now it's all good.
Hope it helps someone else.
This begs the question though as to why my /system is 100% full.
Has anyone yet worked out what we need to block to stop the Microsoft provided metro apps displaying ad's.
(Bonus points if the same thing works for Windows Phone 7 on wifi)
I want to do it by the DNS server static entries rather than hosts but all I need is to know what they use.
If noone has done it yet I will start having a go in a few days.
I doubt you can do anything in a metro app since they are sandboxed. The best you can do is edit the hosts file like in Android.
JihadSquad said:
I doubt you can do anything in a metro app since they are sandboxed. The best you can do is edit the hosts file like in Android.
Click to expand...
Click to collapse
All the ads are through MS, so if anyone knows the IP to block, that would be excellent. We are in a new world with mobile data caps and paying to download ads is not acceptable to me, especially when many pay apps still have them.
may be a hit and miss but may use same server as xbox live advertising feeds?
rpt.rad.msn.com
rad.msn.com
block those and may block the adds
block via router or open dns
rpt.rad.msn.com
rad.msn.com
block those seems to work but leaves a placeholder of xbox logo
seanpr92 said:
rpt.rad.msn.com
rad.msn.com
block those seems to work but leaves a placeholder of xbox logo
Click to expand...
Click to collapse
I found a very easy way to block ads in any Metro app, but you have to do it on a per-app basis. On some apps it leaves a blank placeholder and on some it removes it all together. PM me to learn how but PLEASE do not make it public.
Hi!
How do I permanently block or remove all the Ads in the apps without rooting my Galaxy S4?
Buy the paid-version of the app in question.
Turn off Internet connection.
I do not believe that is possible
there is an approach of building a custom host file that redirects adds into 127.0.0.1 but you need root for that
Other options I do not know, and most probably it's best to just buy the apps you want
DemonWareXT said:
I do not believe that is possible
there is an approach of building a custom host file that redirects adds into 127.0.0.1 but you need root for that
Other options I do not know, and most probably it's best to just buy the apps you want
Click to expand...
Click to collapse
yeh but there are some apps that you cannot buy. it that way.
ads in notifications and new link in the home page.
the ads in notification can be disabled,
is there a way to stop creating new advertistin icon on the "desktop"?
thanks
Even if you are rooted, it wont work now. Adaway used to work very well but as soon as it pulled out from playstore, it doesn't work for me. It doesn't block ad.
sohebq said:
Even if you are rooted, it wont work now. Adaway used to work very well but as soon as it pulled out from playstore, it doesn't work for me. It doesn't block ad.
Click to expand...
Click to collapse
It should still work actually, at least it does for me.
It however, does not work on apps that have the adds compiled in, or cached down.
For example, Astro File manager, without adaway, it display awful adds. With adaway it only displays adds for itself, because it already knows them.
I'm wondering. Is there any app like adfree/adblock to get rid on those pesky ads be it only on the browser or phone wide? Is it/will it be soon possible to edit the hostfile?
Such an app (either an ad-blocker or a HOSTS file editor) would require higher privileges than third-party apps are able to have. We're working on getting around the permissions limits, but so far, there's no promises we can make.