Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Whenever I use apps that have banner ads (I guess that thing is called AdMob?), I get ads from my mobile service provider. This happens only when I connect using the mobile data.

I don't have branding or any apps from my mobile service provider. In fact, I'm on a rooted vanilla stock froyo ROM.

The ads are very annoying. Most of the time, it is about Value Added Services (VAS) and hence If I accidentally click those, I get charged instantly. (for subscription to whatever that stupid ad displayed).

Please don't give me solutions to block the ads completely. I want the normal ads, just not the ads from my service provider.

share|improve this question
1  
Provided you are rooted, Ad-Away is one such ad-block, and it can be customized to allow specific hosts. –  t0mm13b Mar 7 '13 at 16:48

1 Answer 1

Both works the same way. While the usual AdBlockers block all ad-related servers/IPs, you can do the same for selected ones.

Provided your device is rooted, you can block their specific IPs via your hosts file. Just add the server name one per line, and send it to an "invalid" URL such as e.g. 0.0.0.0. An example entry would look like:

adserver.myprovider.com  0.0.0.0

Of course this would mean you have to figure out the URL of the ads displayed. Here apps like OS Monitor might prove helpful, as they show all open network connections:

OS Monitor: Connections OS Monitor: Whois
OS Monitor: Open connections and WhoIs information (source: Google Play)

When such an ad is displayed, immediately open the connection tab in OS Monitor and check the list. The first screenshot1 shows the app in charge is displayed along with the corresponding entry. The status column will most likely hold either *CLOSE_WAIT*, *LAST_ACK*, or (less likely) ESTABLISHED. Tap the entry which seems fitting to get the WhoIs information2. On that page you see the hostname right on top ("DNS"), which is what you then put into your /system/etc/hosts file as described above.

Don't forget to clear the app's cache afterwards, as otherwise cached ads might still be displayed. Continue until you caught them all :)

Another solution is available for certain providers (at least here in Germany): Opt-Out of provider billing, either completely or for given companies. Of course you still need to pay your contract (that's not what is meant here), but you should no longer be automatically charged for ads etc. via your phone bill. Which does not mean nobody might scare you with accuses of a subscription you "bought" -- but that would no longer work for those ads.

share|improve this answer
    
+1 for this interesting solution! Sounds handy, but it could be tedious when my provider uses lots of random multiple IPs instead of a handful of hostnames. I'm guessing maybe using proxies might work but I don't know how to make proxies work on an all app level. –  Power-Inside Mar 3 '13 at 14:59
    
Yepp, it might take a while to get the collection complete. But it's not the IP-addresses which are your concern, but rather the host names (you always map them to 0.0.0.0, as described). And once you recognize a pattern (e.g. adXX.myprovider.com with XX being digits), you could go pro-active and map them all (00..99). Proxies: they mostly need root as well, and you would need a filtering proxy customized for you. So the hosts variant would be easier for you -- unless you can setup your own proxy using wildcards. –  Izzy Mar 3 '13 at 15:12
    
Ooops... Yes, no I see what you've meant: he could be using IPs instead of hostnames. Well, you could block the entire segment then: usually the first two groups stay the same (123.456.789.0 -> 123.456.*.*), so you would only need to block... um, 64K addresses in the worst case... But I cannot imagine more than 100 IPs wasted for that by your provider. Still, you've got to figure out. In the hosts file it should work the same then: 123.456.789.0 0.0.0.0. –  Izzy Mar 3 '13 at 15:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.