2017-06-03 05:20:38 +00:00
Ad Blocking with NetGuard
-------------------------
2016-03-20 10:32:07 +00:00
2017-07-30 13:53:55 +00:00
Instructions (you need to follow **all** the steps):
2016-04-10 16:34:54 +00:00
2019-05-11 18:06:34 +00:00
1. Download/install the latest NetGuard version [from GitHub ](https://github.com/M66B/NetGuard/releases ) (ad blocking is not possible with the Play store version because Google does not allow ad blocking apps in the Play store)
2019-04-26 08:54:49 +00:00
1. Enable the setting *'Filter traffic'* in the advanced options (three dot menu > Settings > Advanced options > Filter traffic; default is disabled except always enabled in Android 5.0 and earlier)
1. Enable the setting *'Block domain names'* in the advanced options (three dot menu > Settings > Advanced options > Block domain names; default is enabled)
2017-07-30 13:53:55 +00:00
1. Import or download [a hosts file ](https://en.wikipedia.org/wiki/Hosts_(file )) using the NetGuard backup settings (three dot menu > Settings > Backup > Download hosts file)
2021-02-03 09:12:16 +00:00
1. Disable browser compression (in Chrome: three dot menu > Settings > Lite mode > Off)
1. Wait at least 10 minutes to let the Android DNS cache time out (clear via Chrome: [chrome://net-internals/#dns ](chrome://net-internals/#dns ))
2017-07-30 13:53:55 +00:00
1. Test to see if ad blocking works by opening [this page ](http://www.netguard.me/test )
1. Enjoy ad blocking, but don't forget to support application developers and website authors in other ways
2016-03-20 10:32:07 +00:00
2016-09-26 07:41:14 +00:00
< br / >
2016-09-26 07:38:17 +00:00
2017-06-21 20:25:06 +00:00
Troubleshooting:
2017-06-23 07:11:11 +00:00
Because of routing bugs, some devices/Android versions require:
2017-06-21 20:25:06 +00:00
* the advanced option *Manage system applications* to be enabled and/or
2017-11-16 15:22:52 +00:00
* the network option *Subnet routing* to be disabled and/or
2020-10-04 09:04:47 +00:00
* two (not just one) DNS server addresses to be set in the advanced options, for example 8.8.8.8 and 8.8.4.4 or more privacy friendly [these ](https://dns.watch/ )
2019-12-23 20:44:36 +00:00
* disabling of private DNS
2017-06-21 20:25:06 +00:00
< br / >
2016-04-10 16:34:54 +00:00
Note that:
2017-06-03 05:20:38 +00:00
* applications, like web browsers, may cache data, so you may 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, Puffin, Chrome w/ data saver, UC Browser, Yandex w/ Turbo, Apus Browser, KK Browser, Onavo Extend, Maxthon) will not have ads blocked as NetGuard cannot see those domain requests
2020-10-24 18:44:48 +00:00
* applications, browsers mostly, can have a private DNS feature (Chrome: three-dots menu, Settings, Privacy, Use secure DNS, turn off)
2020-11-20 06:52:48 +00:00
* applications, including browser, can be system apps, which require managing system apps in the advanced settings to be enabled
* the Android always-on VPN setting *Block connections without VPN* will result in stop sending domain names to the VPN after some time
2017-06-03 05:20:38 +00:00
* YouTube ads are not domain-based, and thus cannot be blocked with NetGuard
2017-06-16 17:55:19 +00:00
* NetGuard ignores the IP addresses in the hosts file, because it does not route blocked domains to localhost
* When NetGuard imports the hosts file, it automatically discards any duplicates entries, so duplicate entries are not a problem and have no performance impact after the file is imported
2017-06-03 05:20:38 +00:00
* you can check the number of hosts (domains) imported by pulling the NetGuard notification down using two fingers if your version of Android supports that functionality
2017-01-08 10:14:50 +00:00
* wildcards are not supported due to performance and battery usage reasons
2019-04-18 14:19:19 +00:00
* it is not possible to edit the hosts file (change/add/delete domain names) with NetGuard
2019-04-26 08:54:49 +00:00
* you can disable ad blocking by disabling the setting *'Block domain names'* in the advanced options
2020-07-31 07:49:04 +00:00
* you cannot exclude a single app from ad blocking because Android resolves domain names on behalf of all apps
2017-04-10 16:46:52 +00:00
* **ad blocking is provided as-is**, see also [here ](https://forum.xda-developers.com/showpost.php?p=71805655&postcount=4668 )
2017-06-03 05:20:38 +00:00
* **ad blocking is not available when NetGuard was installed from the Google Play store!** (disable automatic updates of NetGuard in the Play store application)
2016-03-20 13:58:22 +00:00
2016-09-26 07:41:14 +00:00
< br / >
2016-09-26 07:38:17 +00:00
2016-04-22 05:50:03 +00:00
The NetGuard version from GitHub:
2018-05-25 04:50:05 +00:00
* is signed with the same signature as the version from the Google Play store, so any purchases will be restored (this will not happen with for example the F-Droid version)
2017-06-03 05:20:38 +00:00
* will automatically notify you if there are updates available via GitHub (this can be switched off in NetGuard's settings)
2016-04-22 05:50:03 +00:00
2016-09-26 07:41:14 +00:00
< br / >
2016-09-26 07:38:17 +00:00
2016-10-11 08:54:39 +00:00
Which hosts (ad servers) will be blocked depends on the hosts file being used.
2020-11-11 13:25:55 +00:00
NetGuard downloads the [StevenBlack hosts file ](https://github.com/StevenBlack/hosts ) by default.
2018-11-27 07:20:21 +00:00
2016-10-11 08:54:39 +00:00
< br / >
2016-09-27 04:36:48 +00:00
Automation:
2016-09-26 07:38:17 +00:00
2016-09-27 04:36:48 +00:00
You can automatically download a hosts file by sending this service intent with your favorite automation tool, like Tasker:
2016-09-26 07:38:17 +00:00
2016-09-27 04:36:48 +00:00
`eu.faircode.netguard.DOWNLOAD_HOSTS_FILE`
2016-09-26 07:38:17 +00:00
2016-09-27 04:36:48 +00:00
For example using [adb ](https://developer.android.com/studio/command-line/adb.html ) from the command line:
2016-03-20 13:58:22 +00:00
2016-09-27 04:36:48 +00:00
`adb shell am startservice -a eu.faircode.netguard.DOWNLOAD_HOSTS_FILE`
2016-08-28 08:35:41 +00:00
2016-09-26 07:41:14 +00:00
< br / >
2017-07-13 06:01:32 +00:00
Apart from using a hosts file, you can block most in-app ads by blocking this address in the access list of Google Play services:
2016-08-28 08:35:41 +00:00
*googleads.g.doubleclick.net/443*
2016-09-16 12:21:57 +00:00
2017-07-13 20:21:28 +00:00
You'll need to enable filtering and (temporarily) logging for this (you can do this by using the *Configure* button; check both options)
and you'll need to wait until the address appears (you can speed this up by opening some apps with in-app ads).
2017-07-20 19:59:59 +00:00
Note that ads are likely being cached, so this may not take effect immediately.
2017-07-13 20:21:28 +00:00
2016-09-26 07:41:14 +00:00
< br / >
2016-09-26 07:38:17 +00:00
2016-10-12 16:12:56 +00:00
An alternate way to block advertisements is by using special DNS servers, like these:
2017-06-03 21:33:53 +00:00
* [AdGuard DNS ](https://adguard.com/en/adguard-dns/overview.html ) - Free
* [Alternate DNS ](https://alternate-dns.com/ ) - 14 day free trial
* [NoAd ](https://noad.zone/ ) - Not working as of 2017 June 03
2016-10-12 16:12:56 +00:00
Be sure to read the privacy policies of these services as they might log your DNS requests.
2017-06-03 05:20:38 +00:00
You can set DNS server addresses for all connection types in NetGuard's *Advanced options* .
Note that when you set two DNS server addresses, the default (operating system/network provider) DNS servers will not be used anymore.
2016-10-12 16:12:56 +00:00
Feel free to let me know about other servers or request to add them in alphabetic order by doing a pull request.
< br / >
2017-06-11 11:24:31 +00:00
**Please do not mention this feature in Google Play store comments, since Google does not allow ad blocking applications in the Google Play store.**