private void setUpMediationSettingsForRequest(String moPubId) {
    final ChartboostMediationSettings globalSettings =
        MoPubRewardedVideoManager.getGlobalMediationSettings(ChartboostMediationSettings.class);
    final ChartboostMediationSettings instanceSettings =
        MoPubRewardedVideoManager.getInstanceMediationSettings(
            ChartboostMediationSettings.class, moPubId);

    // Instance settings override global settings.
    if (instanceSettings != null) {
      Chartboost.setCustomId(instanceSettings.getCustomId());
    } else if (globalSettings != null) {
      Chartboost.setCustomId(globalSettings.getCustomId());
    }
  }
 @Override
 public void didDismissRewardedVideo(String location) {
   // This is called before didCloseRewardedVideo and didClickRewardedVideo
   super.didDismissRewardedVideo(location);
   MoPubRewardedVideoManager.onRewardedVideoClosed(ChartboostRewardedVideo.class, location);
   MoPubLog.d("Chartboost rewarded video dismissed for location " + location + ".");
 }
    @Override
    public void didFailToLoadRewardedVideo(String location, CBError.CBImpressionError error) {
      super.didFailToLoadRewardedVideo(location, error);

      if (mLocationsToLoad.contains(location)) {
        MoPubLog.d("Chartboost rewarded video cache failed for location " + location + ".");
        MoPubRewardedVideoManager.onRewardedVideoLoadFailure(
            ChartboostRewardedVideo.class, location, VIDEO_DOWNLOAD_ERROR);
        mLocationsToLoad.remove(location);
      }
    }
    @Override
    public void didCacheRewardedVideo(String location) {
      super.didCacheRewardedVideo(location);

      if (mLocationsToLoad.contains(location)) {
        MoPubLog.d("Chartboost rewarded video cached for location " + location + ".");
        MoPubRewardedVideoManager.onRewardedVideoLoadSuccess(
            ChartboostRewardedVideo.class, location);
        mLocationsToLoad.remove(location);
      }
    }
 @Override
 public void didCompleteRewardedVideo(String location, int reward) {
   super.didCompleteRewardedVideo(location, reward);
   MoPubLog.d(
       "Chartboost rewarded video completed for location "
           + location
           + " with "
           + "reward amount "
           + reward);
   MoPubRewardedVideoManager.onRewardedVideoCompleted(
       ChartboostRewardedVideo.class,
       location,
       MoPubReward.success(MoPubReward.NO_REWARD_LABEL, reward));
 }
 @Override
 public void didDisplayRewardedVideo(String location) {
   super.didDisplayRewardedVideo(location);
   MoPubLog.d("Chartboost rewarded video displayed for location " + location + ".");
   MoPubRewardedVideoManager.onRewardedVideoStarted(ChartboostRewardedVideo.class, location);
 }
 @Override
 public void didClickRewardedVideo(String location) {
   super.didClickRewardedVideo(location);
   MoPubRewardedVideoManager.onRewardedVideoClicked(ChartboostRewardedVideo.class, location);
   MoPubLog.d("Chartboost rewarded video clicked for location " + location + ".");
 }