NetGuard/ADBLOCKING.md

4.0 KiB

Ad blocking

Instructions:

  • Download/install the latest NetGuard version from GitHub
  • Enable the setting 'Filter traffic' in the advanced options (three dot menu > Settings > Advanced options > Filter traffic; default disabled; always enabled on Android 5.0 or earlier)
  • Enable the setting 'Block domain names' in the advanced options (three dot menu > Settings > Advanced options > Block domain names; default enabled)
  • Import or download a hosts file using the NetGuard backup settings (three dot menu > Settings > Backup > Download hosts file)
  • Disable browser compression (Chrome: three dot menu > Settings > Data Saver > Off)
  • Wait at least 10 minutes to let the Android DNS cache time out
  • Test if it works by opening this page
  • Enjoy ad blocking, but don't forget to support application developers in other ways

Note that:

  • applications, like the browser, may cache data, so you might need to clear caches
  • applications, browsers mostly, that have a "data saver" like feature that proxies requests through their servers (eg. Opera w/ Turbo, Opera Max app, Puffin, Chrome w/ data saver, UC Browser, Yandex w/ Turbo, Apus Browser, KK Browser, Onavo Extend, Maxthon) will not have ads blocked as NetGuard can't even see those domain requests
  • YouTube ads are not domain based and cannot be blocked
  • NetGuard does not use the IP addresses in the hosts file, because it doesn't route blocked domains to localhost
  • NetGuard does not concatenate hosts files, so you will have to use a source which does this for you or do it yourself
  • you can check the number of hosts (domains) imported by pulling the NetGuard notification down using two fingers
  • wildcards are not supported due to performance and battery usage reasons
  • ad blocking is provided as-is, see also here
  • ad blocking is not available when NetGuard was installed from the Play store! (disable automatic updates of NetGuard in the Play store application)

The NetGuard version from GitHub:

  • is signed with the same signature as the version from the Play store, so any purchases will be restored
  • will automatically notify you if there are updates (this can be switched off in the settings)

Which hosts (ad servers) will be blocked depends on the hosts file being used. NetGuard provides the StevenBlack hosts file download with the following additions:

  • reports.crashlytics.com
  • settings.crashlytics.com
  • e.crashlytics.com

Automation:

You can automatically download a hosts file by sending this service intent with your favorite automation tool, like Tasker:

eu.faircode.netguard.DOWNLOAD_HOSTS_FILE

For example using adb from the command line:

adb shell am startservice -a eu.faircode.netguard.DOWNLOAD_HOSTS_FILE


Apart from using a hosts file, you can block most in-app ads by blocking this address for Google Play services:

googleads.g.doubleclick.net/443


An alternate way to block advertisements is by using special DNS servers, like these:

You can set DNS server addresses for all connection types in the NetGuard advanced options. Note that when you set two DNS server addresses, the default (operating system/network provider) DNS servers will not be used anymore.

Be sure to read the privacy policies of these services as they might log your DNS requests.

Feel free to let me know about other servers or request to add them in alphabetic order by doing a pull request.


Please do not mention this feature in Google Play store comments, since Google does not allow ad blocking applications in the Play store.