1

I'm trying to permanently display an ironsource banner and it shows nicely the first time it's initiated and told to load.

But after a onResume() happens in my app for whatever reason, it disappears, whether I try to load it again or don't load it, it just disappears.

How could I deal with this issue?

user2638180
  • 1,013
  • 16
  • 37
  • Do you have any logic related to your banner view or to IronSource SDK inside the onResume() implementation? – Adi Oz Apr 09 '21 at 14:21
  • @AdiOz, have right now, anyway either if the logic is there or if it is removed the banner just shows one. – user2638180 Apr 09 '21 at 14:29

1 Answers1

0

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
TexD
  • 162
  • 1
  • 10