Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Line] Call onAdHidden method when onDestroy. #376

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public class LineMediationAdapter
private FiveAdCustomLayout adView;
private FiveAdNative nativeAd;

private MaxInterstitialAdapterListener maxInterstitialAdapterListener;
private MaxRewardedAdapterListener maxRewardedAdapterListener;

public LineMediationAdapter(final AppLovinSdk sdk) { super( sdk ); }

@Override
Expand Down Expand Up @@ -140,6 +143,18 @@ public void initialize(final MaxAdapterInitializationParameters parameters, fina
@Override
public void onDestroy()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onDestroy() will not be called unless the publisher explicitly calls MaxInterstitialAd#destroy() or MaxRewardedAd#destroy() - which most do not.

It is usually called when the "ad hidden" callback is fired from the mediate SDK - your SDK will need to be able to detect the Activity being dismissed and fire the "ad hidden" callback appropriately.

{
// Workaround for LINE SDK does not call onFiveAdClose method when app with Service API closed during displaying a full-screen ad.
if (maxInterstitialAdapterListener != null)
{
maxInterstitialAdapterListener.onInterstitialAdHidden();
maxInterstitialAdapterListener = null;
}
if (maxRewardedAdapterListener != null)
{
maxRewardedAdapterListener.onRewardedAdHidden();
maxRewardedAdapterListener = null;
}

interstitialAd = null;
rewardedAd = null;
adView = null;
Expand Down Expand Up @@ -167,6 +182,7 @@ public void showInterstitialAd(final MaxAdapterResponseParameters parameters, fi
log( "Showing interstitial ad for slot id: " + slotId + "..." );

interstitialAd.show( activity );
maxInterstitialAdapterListener = listener;
}

@Override
Expand All @@ -191,6 +207,7 @@ public void showRewardedAd(final MaxAdapterResponseParameters parameters, final

configureReward( parameters );
rewardedAd.show( activity );
maxRewardedAdapterListener = listener;
}

@Override
Expand Down Expand Up @@ -356,6 +373,7 @@ public void onFiveAdClose(final FiveAdInterface ad)
{
log( "Interstitial ad hidden for slot id: " + ad.getSlotId() + "..." );
listener.onInterstitialAdHidden();
maxInterstitialAdapterListener = null;
}

@Override
Expand Down Expand Up @@ -468,6 +486,7 @@ public void onFiveAdClose(final FiveAdInterface ad)
}
log( "Rewarded ad hidden for slot id: " + ad.getSlotId() + "..." );
listener.onRewardedAdHidden();
maxRewardedAdapterListener = null;
}

@Override
Expand Down