@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;
    }
  }
Ejemplo n.º 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;
 }
Ejemplo n.º 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.");
   }
 }
Ejemplo n.º 7
0
 public void setAutoCacheAds(boolean shouldCache) {
   Chartboost.setAutoCacheAds(shouldCache);
 }
Ejemplo n.º 8
0
 public boolean isAnyViewVisible() {
   return Chartboost.isAnyViewVisible();
 }
Ejemplo n.º 9
0
 @Override
 public void onDestroy() {
   Chartboost.onDestroy((Activity) mContext);
 }
Ejemplo n.º 10
0
 @Override
 public void onStop() {
   Chartboost.onStop((Activity) mContext);
 }
Ejemplo n.º 11
0
 public void disPassAgeGate(boolean pass) {
   Chartboost.didPassAgeGate(pass);
 }
Ejemplo n.º 12
0
 @Override
 public void onPause() {
   Chartboost.onPause((Activity) mContext);
 }
Ejemplo n.º 13
0
 public boolean getAutoCacheAds() {
   return Chartboost.getAutoCacheAds();
 }
Ejemplo n.º 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);
 }