diff --git a/Line/src/main/java/com/applovin/mediation/adapters/LineMediationAdapter.java b/Line/src/main/java/com/applovin/mediation/adapters/LineMediationAdapter.java index ab4256dc98..177b42fbf4 100644 --- a/Line/src/main/java/com/applovin/mediation/adapters/LineMediationAdapter.java +++ b/Line/src/main/java/com/applovin/mediation/adapters/LineMediationAdapter.java @@ -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 @@ -140,6 +143,18 @@ public void initialize(final MaxAdapterInitializationParameters parameters, fina @Override public void onDestroy() { + // 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; @@ -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 @@ -191,6 +207,7 @@ public void showRewardedAd(final MaxAdapterResponseParameters parameters, final configureReward( parameters ); rewardedAd.show( activity ); + maxRewardedAdapterListener = listener; } @Override @@ -356,6 +373,7 @@ public void onFiveAdClose(final FiveAdInterface ad) { log( "Interstitial ad hidden for slot id: " + ad.getSlotId() + "..." ); listener.onInterstitialAdHidden(); + maxInterstitialAdapterListener = null; } @Override @@ -468,6 +486,7 @@ public void onFiveAdClose(final FiveAdInterface ad) } log( "Rewarded ad hidden for slot id: " + ad.getSlotId() + "..." ); listener.onRewardedAdHidden(); + maxRewardedAdapterListener = null; } @Override