B4A Library AdMob library

susu

Well-Known Member
Licensed User
Longtime User
I got that email too. Waiting for Erel's answer
 

Inman

Well-Known Member
Licensed User
Longtime User
It is working correctly now. But I can't seem to get the new ad units sizes (728x90, 300x250, 468x60). Whichever size I set to, it still shows the old ad size.

Wonder if this is the issue of AdMob itself, or the wrapper.
 

moster67

Expert
Licensed User
Longtime User
Anyone who knows which log-messages to look out for to determine if the app is sending requests and is receiving ads or even better, if the app is not receiving any ads due to a modified hosts-file or an ad-blocker?

I'd like to implement a verification to see if an ad-blocker (or a modified host-file) is present on the phone. If yes, I will put my own "ad-image" (in the space meant for the ad) with a link to my site.
 

ssg

Well-Known Member
Licensed User
Longtime User
Hi,

This is one way to do this.

Use 2 panels. First show a panel with your own "ad" on it, say an image or some text. Click event on this panel brings you to wherever you want to.

adview has 2 possible subs, ReceivedAd and FailedToReceiveAd. In received ad, i'll show a 2nd panel which has the adview on it and make my own panel not visible.

In FailedToReceivedAd, you can hide the ad panel and make your own one visible again.

Hope that helps... or am I getting your question wrong?

Cheers!
 

moster67

Expert
Licensed User
Longtime User
@ssg

Spot on my friend! :icon_clap:

To see if an ad-blocker is present, I will adapt this code to B4A:

B4X:
try {
    if (InetAddress.getByName("a.admob.com").getHostAddress().equals("127.0.0.1") ||
        InetAddress.getByName("mm.admob.com").getHostAddress().equals("127.0.0.1") ||
        InetAddress.getByName("p.admob.com").getHostAddress().equals("127.0.0.1") ||
        InetAddress.getByName("r.admob.com").getHostAddress().equals("127.0.0.1")) {
        //Naughty Boy - Punishing code goes here.
        // In my case its a dialog which goes to the pay-for version 
        // of my application in the market once the dialog is closed.
    }
} catch (UnknownHostException e) { } //no internet
 

corwin42

Expert
Licensed User
Longtime User
Is it possible to detect if a user has clicked on an ad?

I'm thinking about a mechanism to disable the ads for some time if a user has clicked on one.
 

magarcan

Active Member
Licensed User
Longtime User
Is it possible to detect if a user has clicked on an ad?

I'm thinking about a mechanism to disable the ads for some time if a user has clicked on one.
this is a very good idea, but I think this is not possible. If anyone of the gurus can tell us something...
 

corwin42

Expert
Licensed User
Longtime User
Hmm, should be possible if the wrapper will wrap these events, too:

public void onPresentScreen(Ad ad);
public void onDismissScreen(Ad ad);
public void onLeaveApplication(Ad ad);
 

NJDude

Expert
Licensed User
Longtime User
How do you set those sizes when you setup the AdMob panel?

B4X:
Activity.AddView(AdBox, 0dip, 375dip, 320dip, 50dip)

The code above is just for a "phone" size, but now with the new variables, how's done?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…