How to filter ads on your G1

Search This thread

delta_foxtrot2

Senior Member
Feb 11, 2009
709
616
You can find the latest version of this app on the slideme app store.

http://slideme.org/application/adfree

This is the old thread, I started a new thread in the general section => http://forum.xda-developers.com/showthread.php?p=40759351

================================================================================================================================================

Spoiled by ad free browsing on my normal desktop computer it became increasingly annoying seeing all the ads on my phone. However it's really easy to make them disappear, although you most likely will need root on the phone.

Download the hosts.txt file from http://www.mvps.org/winhelp2002/hosts.txt, you may need to run dos2unix over the file to remote \r characters, rename the file hosts and copy it to /system/etc on your phone and say goodbye to most ads.

You may find the list to be imperfect, for example some feedburner URLs are "blocked" as a result which can screw with RSS feeds, although it's annoying giving too much info to Google but like everything else in life some things are a trade off.

If you want to root your phone, try this article.
 
Last edited:

delta_foxtrot2

Senior Member
Feb 11, 2009
709
616
As soon as I read the topic title I realised what you were doing and I never thought of it myself.

I've been using this technique for a bit, just didn't think to post about it before did a quick search and noticed no one else had so thought I might as well :)

My hosts file was /etc/hosts though, not /system/etc/hosts

Doesn't seem to matter, I just checked the /etc dir and it has the same hosts file.
 

lbcoder

Senior Member
Jan 21, 2009
2,622
99
Actually, /etc is a symbolic link to /system/etc, so your hosts file is really at /system/etc -- however, accessing the file through either path is equivalent.
 
  • Like
Reactions: ZombiE_IN

ShatBag1105

Senior Member
Feb 9, 2009
115
3
Ha ha hosts exists on android!? I had no idea. I'm also a spoiled ad-less pc user. This is great. Thanks.

If you can't download the file above (it appears as text in browser), replace .txt with .zip at the end of the url. This will download the zip file which u can later unzip with an unzip app in the market.

Ok. I can't paste over the original hosts file using the phone? Astro and lynda file managers don't do it for me. And yes I am rooted, running 1.5 dudes build. Can this be done only from a PC?
 
Last edited:

delta_foxtrot2

Senior Member
Feb 11, 2009
709
616
Ok. I can't paste over the original hosts file using the phone? Astro and lynda file managers don't do it for me. And yes I am rooted, running 1.5 dudes build. Can this be done only from a PC?

You have a couple of options, you can download the terminal app from the market and use it, or you can use ADB to shell into the phone, or wait for someone to code an app to do it all for you.

For the time being go with installing terminal, then type 'su' to become root. That is unless you have a copy of adb handy, if you can 'adb shell' the following commands are the same, except you can copy and paste.

Then remount the system partition read-write.

Code:
mount -o remount,rw /dev/block/mtdblock3 /system

Then you go into the etc dir

Code:
cd /system/etc

Then you can rm the hosts file

Code:
rm hosts

Then grab the hosts.txt file

Code:
wget http://www.mvps.org/winhelp2002/hosts.txt -O hosts

Always more than one way to skin a cat, but the above works for me(tm)
 
Last edited:

Dark X Dragon

Member
Apr 21, 2009
16
1
Actually, /etc is a symbolic link to /system/etc, so your hosts file is really at /system/etc -- however, accessing the file through either path is equivalent.

Ugghh, I read that ages ago but really didn't commit it to memory. It is now. =)


There's a fair chance I won't get around to it but I'm tempted to take this ad blocking further. Namely an automatic app but there might be more to add to it.
 

ShatBag1105

Senior Member
Feb 9, 2009
115
3
Thanks for the help delta. I figured it had to be done in terminal. And you know, this would definitely become very popular as an app.
 

nyayo99

Member
May 2, 2009
13
0
Then grab the hosts.txt file

Code:
wget http://www.mvps.org/winhelp2002/hosts.txt -O hosts

Always more than one way to skin a cat, but the above works for me(tm)

(I am using the terminal program on the phone)

Until the above step, no problems
After typing in the above I get the following message:

"bad address "www.mvps.org"

I checked for typing errors, tried it 3 times but get the same error message

Any suggestions please?

thanks
 

ShatBag1105

Senior Member
Feb 9, 2009
115
3
(I am using the terminal program on the phone)

Until the above step, no problems
After typing in the above I get the following message:

"bad address "www.mvps.org"

I checked for typing errors, tried it 3 times but get the same error message

Any suggestions please?

thanks

Try it without the http://www. It might work like that. This is a lot harder than it should be lol. The g1 is putting up a fight!
 

nyayo99

Member
May 2, 2009
13
0
Try it without the http://www. It might work like that. This is a lot harder than it should be lol. The g1 is putting up a fight!

Thanks, but this didn't work either.
Some googling indicated a possible DNS issue.
So I looked up the IP address (209.68.48.119), substituted that into your instructions and presto, everything worked!

Many thanks for the ad killer option for the G1
 

delta_foxtrot2

Senior Member
Feb 11, 2009
709
616
I plan on suggesting the following URLs to the hosts.txt guy to block admob ads in apps

p.admob.com
analytics.admob.com
r.admob.com

In the mean time you can manually add it to the hosts file yourself, just copy and past from another line.

After updating the hosts file you may need to reboot or wait for the hostname to expire from the internal lookup cache, unless someone knows a quick way to flush the cache to speed up the process that is.
 
Last edited:

delta_foxtrot2

Senior Member
Feb 11, 2009
709
616
Its funny how

127.0.0.1 localhost


is the only thing blocked in the /system/etc/hosts file. lol.

That isn't "blocked" and in fact nothing gets blocked by the hosts file it just points hostnames to the local system, which usually has no web server running so the connection fails immediately.

However you MUST have localhost listed or various things will fail and cause all sorts of issues.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 21
    You can find the latest version of this app on the slideme app store.

    http://slideme.org/application/adfree

    This is the old thread, I started a new thread in the general section => http://forum.xda-developers.com/showthread.php?p=40759351

    ================================================================================================================================================

    Spoiled by ad free browsing on my normal desktop computer it became increasingly annoying seeing all the ads on my phone. However it's really easy to make them disappear, although you most likely will need root on the phone.

    Download the hosts.txt file from http://www.mvps.org/winhelp2002/hosts.txt, you may need to run dos2unix over the file to remote \r characters, rename the file hosts and copy it to /system/etc on your phone and say goodbye to most ads.

    You may find the list to be imperfect, for example some feedburner URLs are "blocked" as a result which can screw with RSS feeds, although it's annoying giving too much info to Google but like everything else in life some things are a trade off.

    If you want to root your phone, try this article.
    7
    I'm getting a fatal error saying that my copy is too old, I'm using latest version from market/play store 8.44

    I've been dreading this day since my hdd was wiped a while back, I've uploaded a new version using a new signing key 0.8.45, but you'll need to remove the current version first.
    6
    I really would like to see Adfree in another store like FDroid!!

    Cheers.!

    I was uploading to slideme.org until I had issues with old signing keys being lost.

    For people wanting the current version I uploaded the apk file to the website: http://adfree.bigtincan.com/adfree.apk
    5
    new Ad blocker

    Hi folks,

    I have released my own hosts-based ad blocker named AdAway, it can be found on the market with the following features:

    • AdAway is Open Source
    • AdAway lets you select your own sources of hosts files
    • You can add exceptions to your Whitelist if some apps are not working with ads disabled
    • You can define extra hostnames in your own Blacklist

    Market: market.android.com/details?id=org.adaway
    Website: code.google.com/p/ad-away
    Source: gitorious.org/adaway

    I would like to hear suggestions and ideas for possible future releases. Please look into the Issue tracker before and add your suggestions there: code.google.com/p/ad-away/issues/list
    5
    Here, a quick edit of the host file to fix the Words with Friends and Medscape. Just copy and paste it into "/system/etc" and overwrite the host file or wherever your host file is located.

    Download: http://www.mediafire.com/?mda7sx9eovfkh03

    If you wanna do this yourself, use a text editor like Notepad++ and just remove any references to server that's being overlayed in Words With Friends and any references to Medscape.
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone