You can do this automatically by using an app like adguard (which is fantastic, but not free).
The app you will need to accomplish this is netguard:
https://play.google.com/store/apps/deta ... e.netguard
Set it up with just the default settings. Once that is done go to settings > advanced and enable filtering. For the DNS we will use adguard's DNS servers. They are:
176.103.130.130
176.103.130.131
This will not only block ads when browsing, but it will block ads in apps as well.
Enjoy!

P.s. Netguard is open source and it's on github.