SDK Configuration Methods

These methods allow you to access Chartboost SDK functionality and settings. Choose a platform to view its methods.
iOS Android & Amazon Unity iOS Swift
 
For iOS SDK 8.2.0 and 8.2.1, please ensure to call the setLoggingLevel method after initialization and not before.
  
// Set a custom identifier to send in the POST body for all Chartboost API server requests.
+ (void)setCustomId:(NSString *)customId;

// Get the current custom identifier being sent in the POST body for all Chartboost API server requests.
+ (NSString *)getCustomId;

// Control whether the SDK downloads video creatives ahead of time for better performance. Enabled by default. If disabled, will severely impact the SDK’s ability to serve video ads!
+ (void)setShouldPrefetchVideoContent:(BOOL)shouldPrefetch;

// Control how much information is logged in the console.
+ (void)setLoggingLevel:(CBLoggingLevel)loggingLevel;

// Mute/unmute chartboost ads.
+ (void)setMuted:(BOOL);
Learn more about caching ▶
▲ Back to top

  // Checks for a cached interstitial at given location.
  public static boolean hasInterstitial(String location)

  // Checks for a cached MoreApps page at given location.
  public static boolean hasMoreApps(String location)

  // Checks for a cached rewarded video at given location.
  public static boolean hasRewardedVideo(String location)

  // Check to see if any views are visible.
  public static boolean isAnyViewVisible()

  // Set to enable and disable the auto cache feature. Enabled by default.
  public static void setAutoCacheAds(boolean autoCacheAds)

  // Get the current auto cache behavior. True by default.
  public static boolean getAutoCacheAds()

  // Set a custom identifier to send in the POST body for all Chartboost API server requests.
  public static void setCustomId(String customID)

  // Get the current custom identifier being sent in the POST body for all Chartboost API server requests.
  public static String getCustomID()

  // Decide if the Chartboost SDK should show interstitials in the first session.
  public static void setShouldRequestInterstitialsInFirstSession(boolean shouldRequest)

  //  Decide if the Chartboost SDK should show a loading view while preparing to display the MoreApps UI.
  public static void setShouldDisplayLoadingViewForMoreApps(boolean shouldDisplay)

  // Decide if the Chartboost SDK will attempt to fetch videos from the Chartboost API servers.
  public static void setShouldPrefetchVideoContent(boolean shouldPrefetch)

  // Control how much information is logged in the console.
  public static void setLoggingLevel(CBLogging.Level lvl)
Learn more about caching ▶
▲ Back to top

  // Checks for a cached interstitial at given CBlocation.
  public static bool hasInterstitial(CBLocation location)

  // Checks for a cached moreApps page at given CBlocation.
  public static bool hasMoreApps(CBLocation location)

  // Checks for a cached rewarded video at given CBlocation.
  public static bool hasRewardedVideo(CBLocation location)

  // Check to see if any views are visible (Android only).
  public static bool isAnyViewVisible()

  // Set to enable and disable the autocache feature. Enabled by default.
  public static void setAutoCacheAds(bool autoCacheAds)

  // Get the current autocache behavior. Enabled by default.
  public static bool getAutoCacheAds()

  // Set a custom identifier to send in the POST body for all Chartboost API server requests.
  public static void setCustomId(String customId)

  // Get the current custom identifier being sent in the POST body for all Chartboost API server requests.
  public static String getCustomId()

  // Decide if the Chartboost SDK should show interstitials in the first session.
  public static void setShouldRequestInterstitialsInFirstSession(bool shouldRequest)

  //  Decide if the Chartboost SDK should show a loading view while preparing to display the MoreApps UI.
  public static void setShouldDisplayLoadingViewForMoreApps(bool shouldDisplay)

  // Decide if the Chartboost SDK will attempt to fetch videos from the Chartboost API servers.
  public static void setShouldPrefetchVideoContent(bool shouldPrefetch)

  // Set to control how the fullscreen ad units should interact with the status bar. CBStatusBarBehaviorIgnore by default.
  // iOS only
  public static void setStatusBarBehavior(CBStatusBarBehavior statusBarBehavior)
Learn more about caching ▶
▲ Back to top

// Checks for a cached interstitial at given CBlocation.
Bool hasInterstitial(location: String!)

// Checks for a cached MoreApps page at given CBlocation.
Bool hasMoreApps(location: String!)

// Checks for a cached rewarded video at given CBlocation.
Bool hasRewardedVideo(location: String!)

// Set to enable and disable the auto cache feature. Enabled by default.
Void setAutoCacheAds(shouldCache: Bool)

// Get the current auto cache behavior. Enabled by default.
Bool getAutoCacheAds()

// Set a custom identifier to send in the POST body for all Chartboost API server requests.
public static func setCustomId(_: String)

// Get the current custom identifier being sent in the POST body for all Chartboost API server requests.
public static func getCustomId() -> String

// Decide if the Chartboost SDK should show interstitials in the first session.
Void setShouldRequestInterstitialsInFirstSession(shouldRequest: Bool)

// Control whether the SDK downloads video creatives ahead of time for better performance. Enabled by default. If disabled, will severely impact the SDK’s ability to serve video ads!
Void setShouldDisplayLoadingViewForMoreApps(shouldDisplay: Bool)

// Decide if the Chartboost SDK will attempt to fetch videos from the Chartboost API servers.
public static func setShouldPrefetchVideoContent(_ : Bool)

// Set to control how the fullscreen ad units should interact with the status bar. CBStatusBarBehaviorIgnore by default.
Void setStatusBarBehavior(statusBarBehavior: CBStatusBarBehavior)

// Control how much information is logged in the console. 
public static func setLoggingLevel(_ : CBLoggingLevel)

// Mute/unmute chartboost ads. 
public static func setMuted(_ : Bool)
Learn more about caching ▶
▲ Back to top

More to explore…