Vas
Vas

Reputation: 2064

Some listeners not firing

I am integrating an Android ad SDK that implements a number of listeners. Some of these listeners are not firing within my app. For example onAdLoaded will fire, but onAdDisplayed will not. This works perfectly fine in the sample app that's provided with the SDK, which leads to thinking it's an issue with integration. However, I can't find anything that's causing this snag. It's absolutely bizarre behaviour that I've never come across before. I know I'm grasping at straws over here, but hypothetically speaking what could be the causes for some listeners not registering while others are? How can I debug this?

Here's some code:

        ad = new InterstitialAd(lastActivity, placementId);
        ad.setAdListener(new InterstitialAdListener() {
            //doesn't fire
            @Override
            public void onInterstitialDisplayed(Ad ad) {
                Log.e(TAG, "INTERSTITIAL DISPLAYED");
                Toast.makeText(lastActivity, "onInterstitialDisplayed", Toast.LENGTH_SHORT).show();
            }

            //doesn't fire
            @Override
            public void onInterstitialDismissed(Ad ad) {
                Log.e(TAG, "INTERSTITIAL DISMISSED");
                Toast.makeText(lastActivity, "onInterstitialDismissed", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onError(Ad ad, AdError adError) {
                Log.e(TAG, "ERROR! " + adError.getErrorMessage());
                Toast.makeText(lastActivity, "onError", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onAdLoaded(Ad ad) {
                Log.e(TAG, "AD LOADED!");
                AdAdapter.this.ad.show();
                Toast.makeText(lastActivity, "onAdLoaded", Toast.LENGTH_SHORT).show();
            }

            //doesn't fire
            @Override
            public void onAdClicked(Ad ad) {
                Log.e(TAG, "AD CLICKED!");
                Toast.makeText(lastActivity, "onAdClicked", Toast.LENGTH_SHORT).show();
            }
        });
        ad.loadAd();

Upvotes: 1

Views: 123

Answers (1)

Vas
Vas

Reputation: 2064

I finally figured out why. I decompiled the SDK to have a closer look. The package name was hardcoded into some of the conditions that relate to the non-firing listeners. I refactor their package name within my build script, but the script ignores strings. So naturally they wouldn't fire because the package name has changed.

Upvotes: 1

Related Questions