Android Question Check to if Ads are blocked

MarcoRome

Expert
Licensed User
Longtime User
Hi all :)
Exist one way to check if ads are blocked ?
Type:
AdBlock Plus
NoRoot Ad-Remover Lite ( this is simple...disconnect wifi o inet about app )
etc.

I think that is possible utilize this Sub :

Sub Ad_FailedToReceiveAd (ErrorCode As String)
Log("failed: " & ErrorCode)
End Sub
Sub Ad_ReceiveAd
Log("received")
End Sub
Sub Ad_AdScreenDismissed
Log("screen dismissed")
End Sub

But i dont found documentation about ErrorCode. Any idea ?
Thank you all



 

Pendrush

Well-Known Member
Licensed User
Longtime User
Simply use HttpUtils2 and try to download http://www.admob.com/robots.txt
You can also test host file for admob blocking (also work on non-rooted devices)

B4X:
Sub TestBlocker As Boolean
    Dim bollReturn as Boolean
    bollReturn = False
    Dim ListChk As List
    Dim tmpString As String
    ListChk = File.ReadList("/etc/", "hosts")
    For i = 0 To ListChk.Size - 1
        tmpString = ListChk.Get(i)
        If tmpString.ToLowerCase.Contains("admob") = True Then
            bollReturn = True
        End If
    Next
    Return bollReturn
End Sub
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
We have a lot App to Block Ads.
1. App that lost Internet - but in this case a lot app dont work
2. App that working to file Hosts ( example AdAway ) - but we have code PendRush
3. App that working without file hosts ( example AdBlock Plus ) - but we have ErrorCode return 0

Found solution ( try with Adblock Plus, AdBlock Remover, Adway, etc. ) if:

B4X:
Sub Ad_FailedToReceiveAd (ErrorCode As String)
if ErrorCode = 0 then
    MsgBox("Disabilite AdsBlock. Bye Bye","Message")
    activity.finish
End Sub

+ code PendRush

B4X:
if TestBlocker = True then
...Bye Bye
end if

so with "both code" working very good.
 
Last edited:
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Adblocker detection and evasion is going to be a cat and mouse game for centuries to come. Thatll never stop. Once it gets detected, it gets updated again to evade it. Always will happen.
 
Upvote 0

Ferdari

Active Member
Licensed User
Longtime User
What AdMob library you are using?

mine never returns any Error Code, im using admobGPS 1.0 for B4A 5.80
 
Last edited:
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
No. Provai tempo fa ( 2014 ).
Perchè hai riscontrato problemi ?

***

No. i tried long time ago (2014).
Why, did you encounter problems ?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I can not try on devices with Android 8 :(
Tested on my Samsung Note 8 (Android 8)without any permission set.
B4X:
    Log(File.ReadList("/etc/", "hosts"))
results in
(ArrayList) [127.0.0.1 localhost, ::1 ip6-localhost]
 
Upvote 0
Top