Question

Chartboost ads Loading activity halts the screen for long time to load the interterestial.I want to know how to remove this loading scene from chartboost ,so that the I can move into my app inside the other activities

@Override
 protected void onStart() {
  super.onStart();
  this.cb.showMoreApps();

   this.cb.onStart(this);                                                            //By Rishi

  // Notify the beginning of a user session. Must not be dependent on user
  // actions or any prior network requests.
  this.cb.startSession();

  // Show an interstitial
  this.cb.showInterstitial();                                                         
 }

 @Override
 protected void onStop() {
  super.onStop();

  this.cb.onStop(this);
 }

 @Override
 protected void onDestroy() {
  super.onDestroy();

  this.cb.onDestroy(this);
 }

 public void onLoadButtonClick(View view) {

  this.cb.showInterstitial();

  String toastStr = "Loading Interstitial";
  if (cb.hasCachedInterstitial())
   toastStr = "Loading Interstitial From Cache";
  Toast.makeText(this, toastStr, Toast.LENGTH_SHORT).show();
 }

 private ChartboostDelegate chartBoostDelegate = new ChartboostDelegate() {

  public boolean shouldDisplayInterstitial(String location) {
   Log.i("", "SHOULD DISPLAY INTERSTITIAL '" + location + "'?");
   return true;
  }

  public boolean shouldRequestInterstitial(String location) {
   Log.i("", "SHOULD REQUEST INSTERSTITIAL '" + location + "'?");
   return true;
  }

  public void didCacheInterstitial(String location) {
   Log.i("", "INTERSTITIAL '" + location + "' CACHED");
  }

  public void didFailToLoadInterstitial(String location) {
   // Show a house ad or do something else when a chartboost
   // interstitial fails to load

   Log.i("", "INTERSTITIAL '" + location + "' REQUEST FAILED");
   // Toast.makeText(FrozenBubble.this,
   //"Interstitial '"+location+"' Load Failed";
   // Toast.LENGTH_SHORT).show();



  }

  public void didDismissInterstitial(String location) {

   // Immediately re-caches an interstitial
   cb.cacheInterstitial(location);

   Log.i("", "INTERSTITIAL '" + location + "' DISMISSED");
   // Toast.makeText(FrozenBubble.this,
   // "Dismissed Interstitial '"+location+"'",
   // Toast.LENGTH_SHORT).show();
  }

  public void didCloseInterstitial(String location) {
   Log.i("", "INSTERSTITIAL '" + location + "' CLOSED");
   // Toast.makeText(FrozenBubble.this,
   // "Closed Interstitial '"+location+"'",
   // Toast.LENGTH_SHORT).show();
  }


  public void didClickInterstitial(String location) {
   Log.i("", "DID CLICK INTERSTITIAL '" + location + "'");
   // Toast.makeText(FrozenBubble.this,
   // "Clicked Interstitial '"+location+"'",
   // Toast.LENGTH_SHORT).show();
  }

  public void didShowInterstitial(String location) {
   Log.i("", "INTERSTITIAL '" + location + "' SHOWN");
  }

  public void didFailToLoadUrl(String url) {
   // Show a house ad or do something else when a chartboost
   // interstitial fails to load

   Log.i("", "URL '" + url + "' REQUEST FAILED");
   // Toast.makeText(FrozenBubble.this, "URL '"+url+"' Load Failed",
   // Toast.LENGTH_SHORT).show();
  }


  public boolean shouldDisplayLoadingViewForMoreApps() {
   return true;
  }

  public boolean shouldRequestMoreApps() {

   return true;
  }

  public boolean shouldDisplayMoreApps() {
   Log.i("", "SHOULD DISPLAY MORE APPS?");
   return true;
  }


  public void didFailToLoadMoreApps() {
   Log.i("", "MORE APPS REQUEST FAILED");
   //Toast.makeText(Menu.this, "More Apps Load Failed",     Toast.LENGTH_SHORT).show();
  }

  public void didCacheMoreApps() {
   Log.i("", "MORE APPS CACHED");
  }

  public void didDismissMoreApps() {
   Log.i("", "MORE APPS DISMISSED");
   //Toast.makeText(Menu.this, "Dismissed More Apps", Toast.LENGTH_SHORT) .show();
  }


  public void didCloseMoreApps() {
   Log.i("", "MORE APPS CLOSED");
   //Toast.makeText(Menu.this, "Closed More Apps", Toast.LENGTH_SHORT).show();
  }


  public void didClickMoreApps() {
   Log.i("", "MORE APPS CLICKED");
   //Toast.makeText(Menu.this, "Clicked More Apps", Toast.LENGTH_SHORT).show();
  }

  public void didShowMoreApps() {
   Log.i("", "MORE APPS SHOWED");
  }


  public boolean shouldRequestInterstitialsInFirstSession() {
   return true;
  }
 };
Was it helpful?

Solution

The quick and easy fix is to have the shouldDisplayLoadingViewForMoreApps delegate method return false.

However the right way to do it is to always cache interstitials (cacheInterstitial) & the more apps page (cacheMoreApps) before displaying them. This way the SDK will preload all assets and there will be no loading time at all.

If you need any more help, feel free to email support@chartboost.com.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top