Re: Customize AdActivity to handle custom event

238 views
Skip to first unread message

Eric Leichtenschlag

unread,
Mar 1, 2013, 6:11:07 PM3/1/13
to google-adm...@googlegroups.com
Hi Chenyf,

I don't think we intend for developers to reach into and try to extend AdActivity. What kind of handle do you need? Is this something that can be solved via app events? I wrote this blog post showing you how you can get your ad to send a message to your app to execute some code.

Thanks,
Eric


On Fri, Feb 22, 2013 at 2:12 AM, chenyf <chen...@gmail.com> wrote:
Hi

We have a rich media interstitial ad which is expected to have the capability of capturing user input when a button is clicked on this ad. For example, when user click on a button on this ad, we can show a form to let user register if they are interested.

In order to do this, I need to handle the AdActivity event when it is triggered. Now I can see the log shows an unhandled intent is being thrown. Can I know how I can extend the AdActivity class to achieve this?

Hope I have made myself clear for my intention.

Thanks for your help.
 

--
 
---
You received this message because you are subscribed to the Google Groups "Google AdMob Ads Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
  

William Ferguson

unread,
Mar 1, 2013, 11:06:57 PM3/1/13
to google-adm...@googlegroups.com
Hi Chenyf, Eric's right, you'd be much better off creating a CustomEventInterstitial and using Admob mediation to deliver it. It will give you flexibility to do whatever you need in your ad.


William

William Ferguson

unread,
Mar 11, 2013, 8:04:58 PM3/11/13
to google-adm...@googlegroups.com
Right, you are delivering an ad through an ad network and want to be able to respond to the url that is invoked from clicking on that ad.

You realise that the ad will also be served to people that haven't installed your app and that when those people click on the ad the system won't be able to find any IntentFilter that matches the URL you are providing so that you will pay for the ad click, but will get no benefit from it.

If you want to serve ads to people that have already installed your app and to have them provide you feedback when they click on those ads then you really need to use a CustomEventListener as Eric and I suggested above.

William


On Thursday, March 7, 2013 4:37:51 PM UTC+10, chenyf wrote:
This is just to update my last post. I have resolved the problem by change the activity intent-filter in my manifest as:


        <activity android:name=".CustomActivity"
            android:label="@string/title_activity_custom">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT"/>
                   <data android:scheme="safari" android:host="my.url" />
            </intent-filter>
        </activity>


Hope it will help anyone having the similar issue.

Thanks Eric and William for your help.

Eric Leichtenschlag

unread,
Mar 11, 2013, 8:35:59 PM3/11/13
to google-adm...@googlegroups.com
Hi Chenyf,

Try using the DfpInterstitialAd object instead of InterstitialAd. It has the setAppEventListener method on it. Also, remember that for interstitials, onReceiveAd() is invoked when the interstitial is received, which is before it's shown. onPresentScreen() will be invoked on the interstitial after you call interstitial.show().

@William, it sounds like chenyf is using DFP, which operates differently than just setting up an ad to serve on any app. When using DFP, you use a different type of ad unit targeted to a specific ad. So this ad will only show on his app, and it'll be guaranteed users have it installed, and his app can handle these urls accordingly.

Cheers,
Eric


Chen Yi Fan

unread,
Mar 11, 2013, 10:00:28 PM3/11/13
to google-adm...@googlegroups.com
Hi Eric:

1. I have tried to use DfpInterstitialAd with the onReceiveAd() method, but this event will only be fired ONCE and it is BEFORE the ads shows. What I need to achieve is to
capture the event during the ads is playing. Like I mentioned earlier on, I managed to do it using Android intent-filter. I am still trying to find the similar way for IOS app.

2. Yes, I am using DFP which the ads will only be served to my own apps.

Thanks.

Eric Leichtenschlag

unread,
Mar 18, 2013, 1:37:55 PM3/18/13
to google-adm...@googlegroups.com
Hey chenyf,

Check out the admob.events.dispatchAppEvent() method in the admob api docs. You can fire this event from your creative at any time during your creative's lifetime. Then the AppEventListener in your app will listen for these events, and can respond accordingly. Here is a blog post I wrote which explains the App Events flow. In that example, an app event is fired when the ad is shown, as well as when the ad is clicked. You could even code up a 5 second timer in your app which then fires off an app event if you wanted. It really depends what your use case is.

Thanks,
Eric


Chen Yi Fan

unread,
Mar 18, 2013, 10:05:13 PM3/18/13
to google-adm...@googlegroups.com
Thanks Eric. I will test it out.

Best Regards

--
 
---
You received this message because you are subscribed to a topic in the Google Groups "Google AdMob Ads Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-admob-ads-sdk/4RbVaGygCo8/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to google-admob-ads...@googlegroups.com.

Chen Yi Fan

unread,
Mar 19, 2013, 5:48:29 AM3/19/13
to google-adm...@googlegroups.com
Hi Eric:

The sample in your blog is for the banner ads, which must register the callback on the banner view before it can receive the ads event. However I am using an insterstitial ads which has no view object to register this callback.
So this method might not work for my case.

Thanks.

Eric Leichtenschlag

unread,
Mar 20, 2013, 7:13:29 PM3/20/13
to google-adm...@googlegroups.com
So the example in the blog post uses the DfpAdView.setAppEventListener method, but in your case you can use DfpInterstitialAd.setAppEventListener to achieve the same thing. Is there some reason you don't think this will work?

Thanks,
Eric


Reply all
Reply to author
Forward
0 new messages