本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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();
}
示例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));
}
示例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();
}