Search code examples
androidadsadblock

How to block ads in a 3rd party app: Android


I am building an operating system for children; the app is a launcher. From this app, children are allowed to use 3rd party apps, except requirements are that the ads should be blocked because some ads are inappropriate for our 3-5 year old targeted audience. Without actually owning these 3rd party apps, I have not thought of too many options for accomplishing this. The only thing I could think of is to turn off network connection while using these apps. Without a network connection, these 3rd party apps will not be able to display their ads. However, I see a huge drawback to this solution. Many (dare I say most) apps are meant to work with an active network connection, and without one these apps do not function.

Can you think of a better way of doing this? Is there a library that exists that I do not know of, or method for doing this that you can enlighten me on?

Thank you in advance.


Solution

  • I have found possible solution to this for other developers building operating systems for children. Adblockplusandroid is pretty useful, there is no root required.

    https://github.com/adblockplus/adblockplusandroid

    Additionally, there are some ways of changing/setting Proxy using Wificonfiguration like

    WifiConfiguration config = new WifiConfiguration(configuration);
          config.ipAssignment = WifiConfiguration.IpAssignment.UNASSIGNED;
          config.proxySettings = WifiConfiguration.ProxySettings.STATIC;
          config.linkProperties.clear();
    
          config.linkProperties.setHttpProxy(new ProxyProperties("127.0.0.1", port, ""));
    

    127.0.0.1 targets ads.