1

I am making a faucet like app, so the app completely relies on ads, is there a way to detect if a user is using an Ad-Blocker? I thought of trying to ping google ads server to see if it can ping the server or not, Will that work? If not what method do you suggest? Thanks!

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • I think you are worrying needlessly. Less that 1% of people are using custom roms or Ad Blockers (stats that I compiled myself after also being concerned about this). Do you really want to code for 1% of all eventualities or do you want to invest some time in more functionality? – iamgopal Feb 24 '18 at 19:50
  • Thanks for the info, i guess you're right. Better invest my time in something else! Thanks! – EpicDragon 68 Feb 24 '18 at 19:56

2 Answers2

1

Quoting Ivan's answer from here

I am aware of one way that ad blocking works (on any computer really), they edit the hosts file to point to localhost for all known ad servers. For android this is located in the "etc/hosts" file.

For example, I use admob ads and a host file that I have taken from custom rom lists the folowing admob entries:

127.0.0.1 analytics.admob.com
127.0.0.1 mmv.admob.com
127.0.0.1 mm.admob.com
127.0.0.1 admob.com
127.0.0.1 a.admob.com
127.0.0.1 jp.admob.com
127.0.0.1 c.admob.com
127.0.0.1 p.admob.com
127.0.0.1 mm1.vip.sc1.admob.com
127.0.0.1 media.admob.com
127.0.0.1 e.admob.com

Now anytime a process tries to resolve the above addresses they are routed to the address listed to the left of them (localhost) in this case.

What I do in my apps is check this host file and look for any admob entries, if I find any I notify the user that I've detected ad blocking and tell them to remove admob entries from there and do't allow them use of the app.

After all what good does it do me if they're not seeing ads? No point in letting them use the app for free.

Here is a code snippet of how I achieve that:

BufferedReader in = null;

try 
{
    in = new BufferedReader(new InputStreamReader(
            new FileInputStream("/etc/hosts")));
    String line;

    while ((line = in.readLine()) != null)
    {
        if (line.contains("admob"))
        {
            result = false;
            break;
        }
    }
} 

I vow that all ad supported apps should check this file. You do not need to be root in order to access it, but writing to it might be a different story.

Also, not sure if there is any other files that act the same on a linux based OS, but at any rate we can always check all of those files.

Any suggestions on improving this are welcome.

Also the app called "Ad Free android" needs root access, meaning that it most likely changes the hosts file in order to achieve its goal.

Özgür Can Karagöz
  • 1,039
  • 1
  • 13
  • 32
iamgopal
  • 634
  • 5
  • 12
  • What about ad-blockers that don't need root? They aren't relying on modifying the hosts file, how tp detect them? – EpicDragon 68 Feb 24 '18 at 19:52
  • The approach in this answer is terrible... so many things not even count.... you could simple try to resolve a hostname and get the ip from response – Rafael Lima Oct 10 '21 at 20:35
1

Preventing Adblockers is not an ideal solution. You will end up losing players, losing visibility on the store (fewer players = less visibility). Plus, no solution will prevent all adblocker, not even close. It could even create frustration and bad rating from these people. So you will end up losing more than anything.

Another solution is to create an advertisement (fake advertisement) yourself advertising your other apps (or partner with another developer to share your own ads). So if you detect that you have no ads to display (regardless of the reason), you can display your personal "fake ad". So if the player used an adblocker or simply put his phone in airplane mode to prevent ads to appear, you will still show an advertisement to them.

That way, there is no gain from the player trying to remove the ads and there is a gain on your side by promoting your other apps.

Bew Games
  • 11
  • 2