@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); } }
@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; }
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); }
@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(); }
@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)); }
@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(); }