Android App Event Listener

259 views
Skip to first unread message

Bob Dole

unread,
Jan 25, 2021, 3:04:11 PM1/25/21
to Google Mobile Ads SDK Developers
I've added to a creative
<script src="//www.gstatic.com/afma/api/v1/google_mobile_app_ads.js"></script>
 
<script>
    document
.addEventListener("DOMContentLoaded", function() {
     
// Send a color=green event when ad loads.
      admob
.events.dispatchAppEvent("color", "green");

      document
.getElementById("ad").addEventListener("click", function() {
       
// Send a color=blue event when ad is clicked.
        admob
.events.dispatchAppEvent("color", "blue");
     
});
   
});
 
</script>

and appropriately added an `AppEventListener` to the view.

I can see that if I call `onAppEvent("event", "url") that the `AppEventListener` executes, but clicking on the creative does not fire the event.

Am I missing something to link the creative js to the `PublisherAdView` `AppEventListener`?

Bob Dole

unread,
Jan 25, 2021, 3:19:07 PM1/25/21
to Google Mobile Ads SDK Developers

This seems to be the same issue as https://groups.google.com/u/0/g/google-admob-ads-sdk/c/Hei5o-mtl8w.  We saw this working in September with adLoader, but no longer see it working.

Mobile Ads SDK Forum Advisor Prod

unread,
Jan 25, 2021, 4:57:48 PM1/25/21
to athletea...@gmail.com, google-adm...@googlegroups.com
Hi Bob,

Thank you for bringing this issue to our attention. While looking over the script that you sent us. I just have one question? Are you using Nativree Android or are you using a 3rd party platform, ie React Native, to do this development in.

If this is React we are unable to offer support for this and would suggest that you reach out to the React community forums. If it is being done in Android, I would ask if there is more code that goes along with this?

Regards,
Google Logo
William Pescherine
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2B3FOf:ref

Bob Weather

unread,
Jan 25, 2021, 5:14:51 PM1/25/21
to Google Mobile Ads SDK Developers
builder.withPublisherAdViewOptions(
PublisherAdViewOptions.Builder().setAppEventListener(MyAppEventListener())
.build()
)

class MyAppEventListener : AppEventListener {
override fun onAppEvent(action: String?, url: String?) {
//Do something here
}
}

This code was working back in September.


Mobile Ads SDK Forum Advisor Prod

unread,
Jan 26, 2021, 12:28:45 AM1/26/21
to athletea...@gmail.com, google-adm...@googlegroups.com

Hi Bob,

Thank you for providing further context on your concern.

Kindly note that this is a known bug on our end, and is being actively looked at by the rest of the team already. We'll keep you updated for any new developments on this.

Google Logo
Ziv Yves Sanchez
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2B3FOf:ref
Reply all
Reply to author
Forward
0 new messages