java.lang.NoSuchMethodException#com.google.ads.mediation.admob.AdMobAdapter源码实例Demo

下面列出了java.lang.NoSuchMethodException#com.google.ads.mediation.admob.AdMobAdapter 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: admob-plus   文件: AdmobPlus.java
private AdRequest.Builder createAdRequestBuilder(PluginCall call) {
    AdRequest.Builder builder = new AdRequest.Builder();

    JSArray testDevices = call.getArray("testDevices", new JSArray());
    for (int i = 0; i < testDevices.length(); i++) {
        try {
            builder.addTestDevice(testDevices.getString(i));
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    if (call.getBoolean("childDirected") != null) {
        builder.tagForChildDirectedTreatment(call.getBoolean("childDirected"));
    }

    Boolean nonPersonalizedAds = call.getBoolean("nonPersonalizedAds");
    if (nonPersonalizedAds != null && nonPersonalizedAds) {
        Bundle extras = new Bundle();
        extras.putString("npa", "1");
        builder.addNetworkExtrasBundle(AdMobAdapter.class, extras);
    }

    return builder;
}
 
源代码2 项目: admob-plus   文件: Action.java
public AdRequest buildAdRequest() {
    Bundle extras = new Bundle();
    AdRequest.Builder builder = new AdRequest.Builder();
    JSONArray testDevices = this.opts.optJSONArray("testDevices");
    if (testDevices != null) {
        for (int i = 0; i < testDevices.length(); i++) {
            String testDevice = testDevices.optString(i);
            if (testDevice != null) {
                builder.addTestDevice(testDevice);
            }
        }
    }
    if (this.opts.has("childDirected")) {
        builder.tagForChildDirectedTreatment(opts.optBoolean("childDirected"));
    }
    if (this.opts.has("npa")) {
        extras.putString("npa", opts.optString("npa"));
    }
    if (this.opts.has("underAgeOfConsent")) {
        extras.putBoolean("tag_for_under_age_of_consent", opts.optBoolean("underAgeOfConsent"));
    }
    return builder.addNetworkExtrasBundle(AdMobAdapter.class, extras).build();
}
 
源代码3 项目: cordova-admob-pro   文件: AdMobPlugin.java
@Override
protected Object __prepareRewardVideoAd(String adId) {
  // safety check to avoid exceptoin in case adId is null or empty
  if(adId==null || adId.length()==0) adId = TEST_REWARDVIDEO_ID;

  RewardedVideoAd ad = MobileAds.getRewardedVideoAdInstance(getActivity());
  ad.setRewardedVideoAdListener(new RewardVideoListener());

  synchronized (mLock) {
    if (!mIsRewardedVideoLoading) {
      mIsRewardedVideoLoading = true;
      Bundle extras = new Bundle();
      extras.putBoolean("_noRefresh", true);
      AdRequest adRequest = new AdRequest.Builder()
              .addNetworkExtrasBundle(AdMobAdapter.class, extras)
              .build();
      ad.loadAd(adId, adRequest);
    }
  }

  return ad;
}
 
源代码4 项目: FlappyCow   文件: Game.java
private void setupAd() {
    MobileAds.initialize(this, getResources().getString(R.string.ad_app_id));

    interstitial = new InterstitialAd(this);
    interstitial.setAdUnitId(getResources().getString(R.string.ad_unit_id));

    Bundle extras = new Bundle();
    // Make sure only adds appropriate for children of all ages are displayed.
    extras.putString("max_ad_content_rating", "G");

    AdRequest adRequest = new AdRequest.Builder()
            .addNetworkExtrasBundle(AdMobAdapter.class, extras)
            .build();

    interstitial.loadAd(adRequest);
    interstitial.setAdListener(new MyAdListener());
}
 
源代码5 项目: GDPR-Admob-Android   文件: ConsentSDK.java
public static AdRequest getAdRequest(Context context) {
    if(isConsentPersonalized(context)) {
        return new AdRequest.Builder().build();
    } else {
        return new AdRequest.Builder()
                .addNetworkExtrasBundle(AdMobAdapter.class, getNonPersonalizedAdsBundle())
                .build();
    }
}
 
源代码6 项目: Trivia-Knowledge   文件: MainGameActivity.java
public void loadAdRewardedVideo() {
    if (!mAd.isLoaded()) {

        Bundle extras = new Bundle();
        extras.putBoolean("_noRefresh", true);
        AdRequest adRequest = new AdRequest.Builder()
                .addNetworkExtrasBundle(AdMobAdapter.class, extras)
                //.addNetworkExtrasBundle(ChartboostAdapter.class, extras)
                .addNetworkExtrasBundle(UnityAdapter.class, extras)
                .build();
        mAd.loadAd(getString(R.string.Test_admob_unit_id_rewardedVideo), adRequest);
        // Toast.makeText(MainGameActivity.this,"called",Toast.LENGTH_LONG).show();
    }
}
 
源代码7 项目: remixed-dungeon   文件: AdMob.java
public static AdRequest makeAdRequest() {
    if (EuConsent.getConsentLevel() < EuConsent.PERSONALIZED) {
        Bundle extras = new Bundle();
        extras.putString("npa", "1");

        return new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class, extras).build();
    }

    return new AdRequest.Builder().build();
}
 
public static AdRequest buildRequest(TargetingParameters targetingParameters) {
    AdRequest.Builder builder = new AdRequest.Builder();

    if (targetingParameters != null) {
        if (targetingParameters.getLocation() != null) {
            builder.setLocation(targetingParameters.getLocation());
        }
        Bundle bundle = new Bundle();

        if (targetingParameters.getAge() != null) {
            bundle.putString("Age", targetingParameters.getAge());
        }

        for (Pair<String, String> p : targetingParameters.getCustomKeywords()) {
            if (p.first.equals("content_url")) {
                if (!StringUtil.isEmpty(p.second)) {
                    builder.setContentUrl(p.second);
                }
            } else {
                bundle.putString(p.first, p.second);
            }
        }

        builder.addNetworkExtrasBundle(AdMobAdapter.class, bundle);
    }


    return builder.build();
}
 
源代码9 项目: cordova-plugin-admob-free   文件: AdMob.java
public AdRequest buildAdRequest() {
    AdRequest.Builder builder = new AdRequest.Builder();
    if (config.isTesting || isRunningInTestLab()) {
        builder = builder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR).addTestDevice(getDeviceId());
    }

    if (config.testDeviceList != null) {
        Iterator<String> iterator = config.testDeviceList.iterator();
        while (iterator.hasNext()) {
            builder = builder.addTestDevice(iterator.next());
        }
    }

    Bundle bundle = new Bundle();
    bundle.putInt("cordova", 1);
    if (config.adExtras != null) {
        Iterator<String> it = config.adExtras.keys();
        while (it.hasNext()) {
            String key = it.next();
            try {
                bundle.putString(key, config.adExtras.get(key).toString());
            } catch (JSONException exception) {
                Log.w(TAG, String.format("Caught JSON Exception: %s", exception.getMessage()));
            }
        }
    }
    builder = builder.addNetworkExtrasBundle(AdMobAdapter.class, bundle);

    if (config.gender != null) {
        if ("male".compareToIgnoreCase(config.gender) != 0) {
            builder.setGender(AdRequest.GENDER_MALE);
        } else if ("female".compareToIgnoreCase(config.gender) != 0) {
            builder.setGender(AdRequest.GENDER_FEMALE);
        } else {
            builder.setGender(AdRequest.GENDER_UNKNOWN);
        }
    }
    if (config.location != null) {
        builder.setLocation(config.location);
    }
    if ("yes".equals(config.forFamily)) {
        builder.setIsDesignedForFamilies(true);
    } else if ("no".equals(config.forFamily)) {
        builder.setIsDesignedForFamilies(false);
    }
    if ("yes".equals(config.forChild)) {
        builder.tagForChildDirectedTreatment(true);
    } else if ("no".equals(config.forChild)) {
        builder.tagForChildDirectedTreatment(false);
    }
    if (config.contentURL != null) {
        builder.setContentUrl(config.contentURL);
    }

    return builder.build();
}