I found solution.
When We go to any other activity and come back with Backpress
then ironSource Banner blank.
My Mistake: I was using IronSource.onPause(this);
before super
.
Solution:
// add ironsouce in activity lifecycle
@Override
protected void onPause() {
// don't use "IronSouce" before super
super.onPause();
IronSource.onPause(this);
}
@Override
protected void onResume() {
super.onResume();
IronSource.onResume(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
//destroy ironSource Banner
IronSource.destroyBanner(bannerIronSource);
}
If you do not find best practice to use IronSource Banner then I also provide this code:
<FrameLayout
android:background="#ffffff"
android:id="@+id/bannerContainerIronSourceForm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:visibility="visible" />
Implement this IronSourceBanner inside this FrameLayout.
//ironsource banner
private IronSourceBannerLayout bannerIronSource; //make this universal
IronSource.init(this, "10**appIdHere", IronSource.AD_UNIT.BANNER);
final FrameLayout bannerContainerIronSource= findViewById(R.id.bannerContainerIronSource);
bannerIronSource = IronSource.createBanner(this, ISBannerSize.BANNER);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
bannerContainerIronSource.addView(bannerIronSource, 0, layoutParams);
IronSource.loadBanner(bannerIronSource); //for show