@Override
  public boolean checkAndInitializeSdk(
      @NonNull Activity launcherActivity,
      @NonNull Map<String, Object> localExtras,
      @NonNull Map<String, String> serverExtras)
      throws Exception {
    synchronized (ChartboostRewardedVideo.class) {
      if (sInitialized) {
        return false;
      }

      if (!serverExtras.containsKey(APP_ID_KEY)) {
        throw new IllegalStateException(
            "Chartboost rewarded video initialization" + " failed due to missing application ID.");
      }

      if (!serverExtras.containsKey(APP_SIGNATURE_KEY)) {
        throw new IllegalStateException(
            "Chartboost rewarded video initialization"
                + " failed due to missing application signature.");
      }

      final String appId = serverExtras.get(APP_ID_KEY);
      final String appSignature = serverExtras.get(APP_SIGNATURE_KEY);

      Chartboost.startWithAppId(launcherActivity, appId, appSignature);
      Chartboost.setDelegate(sSingletonChartboostDelegate);

      sInitialized = true;
      return true;
    }
  }
Пример #2
0
 public boolean isAvailable(String loc, int type) {
   switch (type) {
     case CB_TYPE_INTERSTITIAL:
       return Chartboost.hasInterstitial(loc);
     case CB_TYPE_REWARDED_VIDEO:
       return Chartboost.hasRewardedVideo(loc);
     case CB_TYPE_MORE_APPS:
       return Chartboost.hasMoreApps(loc);
   }
   return false;
 }
Пример #3
0
 public void cache(String loc, int type) {
   switch (type) {
     case CB_TYPE_INTERSTITIAL:
       Chartboost.cacheInterstitial(loc);
       break;
     case CB_TYPE_REWARDED_VIDEO:
       Chartboost.cacheRewardedVideo(loc);
       break;
     case CB_TYPE_MORE_APPS:
       Chartboost.cacheMoreApps(loc);
       break;
   }
 }
  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());
    }
  }
 protected static String a() {
   String str = null;
   try {
     Info advertisingIdInfo =
         AdvertisingIdClient.getAdvertisingIdInfo(Chartboost.sharedChartboost().getContext());
   } catch (IOException e) {
     String str2 = str;
   } catch (GooglePlayServicesRepairableException e2) {
     str2 = str;
   } catch (GooglePlayServicesNotAvailableException e3) {
     str2 = str;
   }
   if (advertisingIdInfo == null) {
     c.a(a.c);
     return str;
   } else {
     if (advertisingIdInfo.isLimitAdTrackingEnabled()) {
       c.a(a.e);
     } else {
       c.a(a.d);
     }
     try {
       UUID fromString = UUID.fromString(advertisingIdInfo.getId());
       ByteBuffer wrap = ByteBuffer.wrap(new byte[16]);
       wrap.putLong(fromString.getMostSignificantBits());
       wrap.putLong(fromString.getLeastSignificantBits());
       return b.b(wrap.array());
     } catch (IllegalArgumentException e4) {
       CBLogging.a("CBIdentityAdv", "Exception raised retrieveAdvertisingID", e4);
       return advertisingIdInfo.getId().replace("-", AdTrackerConstants.BLANK);
     }
   }
 }
 @Override
 public void showVideo() {
   if (hasVideoAvailable()) {
     Chartboost.showRewardedVideo(mLocation);
   } else {
     MoPubLog.d("Attempted to show Chartboost rewarded video before it was available.");
   }
 }
Пример #7
0
 public void setAutoCacheAds(boolean shouldCache) {
   Chartboost.setAutoCacheAds(shouldCache);
 }
Пример #8
0
 public boolean isAnyViewVisible() {
   return Chartboost.isAnyViewVisible();
 }
Пример #9
0
 @Override
 public void onDestroy() {
   Chartboost.onDestroy((Activity) mContext);
 }
Пример #10
0
 @Override
 public void onStop() {
   Chartboost.onStop((Activity) mContext);
 }
Пример #11
0
 public void disPassAgeGate(boolean pass) {
   Chartboost.didPassAgeGate(pass);
 }
Пример #12
0
 @Override
 public void onPause() {
   Chartboost.onPause((Activity) mContext);
 }
Пример #13
0
 public boolean getAutoCacheAds() {
   return Chartboost.getAutoCacheAds();
 }
Пример #14
0
 public void closeImpression() {
   Chartboost.closeImpression();
 }
 @Override
 public boolean hasVideoAvailable() {
   return Chartboost.hasRewardedVideo(mLocation);
 }
 @Override
 public void onResume(@NonNull Activity activity) {
   Chartboost.onResume(activity);
 }
 @Override
 public void onStop(@NonNull Activity activity) {
   Chartboost.onStop(activity);
 }
 @Override
 public void onBackPressed(@NonNull Activity activity) {
   Chartboost.onBackPressed();
 }
 @Override
 public void onDestroy(@NonNull Activity activity) {
   Chartboost.onDestroy(activity);
 }