Saturday, August 22, 2015

How to block ads in Android applications?


Are there ways that attempt to block ads in applications? It seems that it should be theoretically possible, by blocking web requests to certain sites, for example.



Answer



The most popular method is replacing the built-in hosts files with one that forces DNS queries to well-known ad servers to result in 127.0.0.1 (localhost). This effectively blocks most common ads, and most of the Google Ads in applications.


The downside is that applications can tell that ads are being blocked, and can either refuse to run or otherwise degrade their usefulness while the ad blocking is in effect.


Also, root access is required to replace the hosts file.



Beyond that, I haven't seen anything that can selectively block web requests for arbitrary apps. For some programs that only use internet access for ads, you could use a firewall app to prevent them from accessing the internet or -- if your ROM supports it (like the latest CyanogenMod) -- revoke the internet access permission from the app.


Again, root access is generally required to set up a system-wide app-level firewall or replace your ROM.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...