当前位置: 首页>>代码示例>>Java>>正文


Java PublisherInterstitialAd类代码示例

本文整理汇总了Java中com.google.android.gms.ads.doubleclick.PublisherInterstitialAd的典型用法代码示例。如果您正苦于以下问题:Java PublisherInterstitialAd类的具体用法?Java PublisherInterstitialAd怎么用?Java PublisherInterstitialAd使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PublisherInterstitialAd类属于com.google.android.gms.ads.doubleclick包,在下文中一共展示了PublisherInterstitialAd类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.google.android.gms.ads.doubleclick.PublisherInterstitialAd; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mPublisherInterstitialAd = new PublisherInterstitialAd(this);
    mPublisherInterstitialAd.setAdUnitId("ca-app-pub-2834532364021285/5336279451");
    requestNewInterstitial();

    if(CalculatorSettings.useLightTheme(this)) {
        super.setTheme(R.style.Theme_Settings_Calculator_Light);
    }

    if(savedInstanceState == null) {
        PreferencesFragment fragment = new PreferencesFragment();
        fragment.setArguments(getIntent().getExtras());
        getFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit();
    }

    ActionBar mActionBar = getActionBar();
    if (mActionBar != null) {
        mActionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
开发者ID:numixproject,项目名称:com.numix.calculator,代码行数:24,代码来源:Preferences.java

示例2: onCreateView

import com.google.android.gms.ads.doubleclick.PublisherInterstitialAd; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    root = inflater.inflate(R.layout.fragment_interstitial, null);
    // interstitial set up
    mPublisherInterstitialAd = new PublisherInterstitialAd(getContext());
    mPublisherInterstitialAd.setAdUnitId(Constants.DFP_INTERSTITIAL_ADUNIT_ID_FULLSCREEN);
    mPublisherInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdFailedToLoad(int i) {
            super.onAdFailedToLoad(i);
            if (i == AdRequest.ERROR_CODE_INTERNAL_ERROR) {
                LogUtil.e("DFP", "Interstitial Ad failed to load internal error");
            } else if (i == AdRequest.ERROR_CODE_INVALID_REQUEST) {
                LogUtil.e("DFP", "Interstitial Ad failed to load internal error");
            } else if (i == AdRequest.ERROR_CODE_NETWORK_ERROR) {
                LogUtil.e("DFP", "Interstitial Ad failed to load network error");
            } else if (i == AdRequest.ERROR_CODE_NO_FILL) {
                LogUtil.e("DFP", "Interstitial Ad failed to load no fill");
            }
        }

        @Override
        public void onAdLoaded() {
            super.onAdLoaded();
            mPublisherInterstitialAd.show();
        }
    });
    request = new PublisherAdRequest.Builder().build();
    Button btnLoad = (Button) root.findViewById(R.id.loadInterstitial);
    btnLoad.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            loadInterstitial(v);
        }
    });
    return root;
}
 
开发者ID:prebid,项目名称:prebid-mobile-android,代码行数:40,代码来源:DFPInterstitialFragment.java

示例3: getPopup

import com.google.android.gms.ads.doubleclick.PublisherInterstitialAd; //导入依赖的package包/类
private void getPopup(String adCode){
    final PublisherInterstitialAd interstitialAd = new PublisherInterstitialAd(getActivity());
    interstitialAd.setAdUnitId(adCode);
    interstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
        }

        @Override
        public void onAdLoaded() {
            interstitialAd.show();
        }

        @Override
        public void onAdFailedToLoad(int errorCode) {
        }

        @Override
        public void onAdLeftApplication() {
            super.onAdLeftApplication();
        }

        @Override
        public void onAdOpened() {
            super.onAdOpened();
        }
    });
    PublisherAdRequest adRequest = new PublisherAdRequest.Builder().build();
    interstitialAd.loadAd(adRequest);
}
 
开发者ID:hotmobmobile,项目名称:hotmob-android-sdk,代码行数:31,代码来源:MediationPopupFragment.java

示例4: onCreate

import com.google.android.gms.ads.doubleclick.PublisherInterstitialAd; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);

    // Create the InterstitialAd and set the adUnitId.
    mInterstitialAd = new PublisherInterstitialAd(this);
    // Defined in res/values/strings.xml
    mInterstitialAd.setAdUnitId(getString(R.string.ad_unit_id));

    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
            startGame();
        }

        @Override
        public void onAdLoaded() {
            mAdIsLoading = false;
        }

        @Override
        public void onAdFailedToLoad(int errorCode) {
            mAdIsLoading = false;
        }
    });

    // Create the "retry" button, which tries to show an interstitial between game plays.
    mRetryButton = findViewById(R.id.retry_button);
    mRetryButton.setVisibility(View.INVISIBLE);
    mRetryButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showInterstitial();
        }
    });

    startGame();
}
 
开发者ID:googlesamples,项目名称:android-ads,代码行数:40,代码来源:MyActivity.java

示例5: requestAd

import com.google.android.gms.ads.doubleclick.PublisherInterstitialAd; //导入依赖的package包/类
@Override
public void requestAd(MediatedInterstitialAdViewController mIC, Activity activity,
                      String parameter, String adUnitId, TargetingParameters targetingParameters) {
    adListener = new GooglePlayAdListener(mIC, super.getClass().getSimpleName());
    adListener.printToClog(String.format(" - requesting an ad: [%s, %s]", parameter, adUnitId));

    interstitialAd = new PublisherInterstitialAd(activity);
    interstitialAd.setAdUnitId(adUnitId);
    interstitialAd.setAdListener(adListener);

    interstitialAd.loadAd(buildRequest(targetingParameters));
}
 
开发者ID:appnexus,项目名称:mobile-sdk-android,代码行数:13,代码来源:GooglePlayDFPInterstitial.java

示例6: onCreate

import com.google.android.gms.ads.doubleclick.PublisherInterstitialAd; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_play);
	
	AdView adView = (AdView)this.findViewById(R.id.adView);
	AdRequest adRequest = new AdRequest.Builder()
	   .build();
	adView.loadAd(adRequest);
	
	interstitial = new PublisherInterstitialAd(this);
	interstitial.setAdUnitId("ca-app-pub-7166295480563138/3626215601");
	adRequestI = new PublisherAdRequest.Builder().build();
	interstitial.loadAd(adRequestI);
	
	
	SharedPreferences pre = getSharedPreferences("mynew", MODE_PRIVATE); 
	inert=pre.getInt("ads", inert);
	SharedPreferences shared = getSharedPreferences("mynew", Context.MODE_PRIVATE);
	Editor editors = shared.edit();
       if(inert==201)
       	inert=0;
       //for ads
       inert++;
	editors.putInt("ads", inert);
	editors.commit();
	
      	Typeface face = Typeface.createFromAsset(getAssets(),"font1.ttf");
	back=new Random();
	sl=false;
    bg=(RelativeLayout)findViewById(R.id.base);
   
    int ran = back.nextInt(7-1)+1+1;
    Log.v("color",""+ran);
    bg.getBackground().setColorFilter(Color.parseColor(colors[ran]), PorterDuff.Mode.SRC);
	s=false;
	word=new words();
	tv = (TextView)findViewById(R.id.textView1);
	sc = (TextView)findViewById(R.id.textView2);
	tv.setTypeface(face);
	sc.setTypeface(face);
	drop_layout = (LinearLayout)findViewById(R.id.drop);
	yesbut=(Button)findViewById(R.id.yesbut);
	nobut=(Button)findViewById(R.id.nobut);
	tv1=(TextView)findViewById(R.id.tv11);
	tv2=(TextView)findViewById(R.id.tv22);
		
	 pb=(ProgressBar)findViewById(R.id.progressbar);
	 mp = MediaPlayer.create(getApplicationContext(), R.raw.sound);
	       Resources res = getResources();
		   Drawable drawable = res.getDrawable(R.drawable.background);
		   pb.setProgress(2500);   // Main Progress
		   pb.setSecondaryProgress(5000);// Secondary Progress
		   pb.setMax(10000);
		   
		   pb.setProgressDrawable(drawable);
		   animation = ObjectAnimator.ofInt(pb, "progress",10000,5000,2500,0);
		   animation.setDuration(1100);
	   	   pb.setProgress(10000);
		   slidel = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_left);
  
	call();
	repeat();
	
}
 
开发者ID:prashant2018,项目名称:Broken-English,代码行数:66,代码来源:Play.java


注:本文中的com.google.android.gms.ads.doubleclick.PublisherInterstitialAd类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。